Android Question Convert b4xview to GifView

rkxo

Active Member
Licensed User
Longtime User
Hi
Its possible add GifView to B4xview?
B4X:
        Dim lbl1 As GifViewer
        lbl1.Initialize(Me,"")' error
        lbl1.SetGif(File.DirAssets, "loading_large.gif")
        Dim xlbl As B4XView = lbl1.GetBase
    
        p.AddView(xlbl, radius, radius, 0, 0)
    
        Dim duration As Int = animationDuration
        xlbl.SetLayoutAnimated(duration, 0, 0, radius * 2, radius * 2)
        xlbl.SetVisibleAnimated(animationDuration, True)

** Activity (main) Resume **
*** Service (cargadordb) Create ***
** Service (cargadordb) Start **
Clicked: cart
Error occurred on line: 49 (GifViewer)
java.lang.RuntimeException: Object should first be initialized (Panel).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50)
at anywheresoftware.b4a.objects.ViewWrapper.getLayoutParams(ViewWrapper.java:325)
at anywheresoftware.b4a.objects.ViewWrapper.getWidth(ViewWrapper.java:152)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA$1.run(BA.java:335)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Thanks
 
Last edited:

rkxo

Active Member
Licensed User
Longtime User
i can't add to panel with loadlayout without designer.
Per exemple..
i have
B4X:
Dim lbl1 As GifViewer
    lbl1.Initialize(Main,"")
        lbl1.SetGif(File.DirAssets,Filename)
        Dim xlbl1 As Panel =lbl1.GetBase

i can't add with loadlayout
B4X:
  xlbl1.loadlayout(lbl1)

i want insert gifview in a recursive panel/view without design editor at runtime. its possible?
 
Last edited:
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Create a layout with just the view. Load this layout to any panel you need it in. You can use the layout 100 times if you want (in 100 panels).
 
Upvote 0
Top