Android Question [B4X] B4XGifView Adding view from code (SOLVED)

walterf25

Expert
Licensed User
Longtime User
Is there a way to add the B4XGifView not from the designer but from code, I just tried it and i get the following error:

This is how I am initializing the view:
B4X:
    Dim gif As B4XGifView
    Dim pnl As B4XView = xui.CreatePanel("")
    gif.Initialize(Me, "gif")
    pnl.SetLayoutAnimated(0,0,0, pnlCamera.Width, pnlCamera.Height/2)
    pnl.AddView(gif.mBase, 0, 0, pnl.Width, pnl.Height)
    gif.SetGif(File.DirAssets, gifName)
    Return pnl

I don't have time to look at the source code, but i guess i'll have to make time and see what's going on, I thought it would just work.

Walter
 

walterf25

Expert
Licensed User
Longtime User
Never mind, solved it,

B4X:
    Dim gif As B4XGifView
    Dim lbl As Label
    Dim m As Map
    lbl.Initialize("")
    m.Initialize
    Dim pnl As B4XView = xui.CreatePanel("")
    gif.Initialize(Me, "gif")
    pnl.SetLayoutAnimated(0,0,0, pnlCamera.Width, pnlCamera.Height/2)
    gif.DesignerCreateView(pnl, lbl, m)
    '''pnl.AddView(gif.GifDrawable, 0, 0, pnl.Width, pnl.Height)
    gif.SetGif(File.DirAssets, gifName)
    Return pnl
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…