Android Question B4X Gif View How to Stop Loop

Angel Garcia

Member
Licensed User
Hello all,
I've been trying this new B4XView and it works great but, i need a function or something to stop the loop of the gif or to set to Null to the control.
I have already tried:
Code: Copy
B4XGifView1.mBase.SetBitmap(Null)

B4XGifView1.GifDrawable=Null

With no success, only thing to do like a "workaround" is to hide the gif with this:
B4XGifView1.mBase.Visible= False

Is there a better way?
Am i missing something?

Many thanks in advance!
 
If the B4X Gif viewer doesn't have any kind of "stop" method, then you could take a screen shot of a frame from the gif (the frame that you like the best), and then when you want to "stop" the animation, load the bitmap of that one frame into the B4XGifViewer.
 
Upvote 0
Hi John,
I just tried what you said but, now the snapshot bitmap is overlaped to the animation and still looping behind hahaha. ?
I think there should be a function to set to Null the GifDrawable, but i cant find the proper method.
Any other ideas?
 
Upvote 0
I haven't used the B4X Gif Viewer, but that might be a bug because if you load a new bitmap into it, it should replace the existing one.
 
Upvote 0
Hello!
Thank you Erel,
You solution worked perfectly!!

To trigger the animation i used:
Code: Copy
B4XGifView1.SetGif(File.DirAssets, "Graph_10s.gif")

And to stop it:
Code: Copy
If B4XGifView1.GifDrawable.IsInitialized=True Then
        B4XGifView1.mBase.GetView(0).SetBitmap(Null)
        B4XGifView1.GifDrawable.RunMethod("recycle",Null)
        B4XGifView1.GifDrawable=Null
End If

Cheers!!
 
Upvote 0
Back
Top