Android Question how do we Initialize B4XGifView ?

jchal

Active Member
Licensed User
Longtime User
hi all
i am trying to display an animated gif but i need to initialize it first as i am getting the following error and the application crashes
Logger connected to: Xiaomi Redmi Note 5A Prime
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
** Activity (activity2) Create, isFirst = true **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
Error occurred on line: 27 (Activity2)
java.lang.RuntimeException: Class instance was not initialized (b4xgifview)
at anywheresoftware.b4a.debug.Debug.shouldDelegate(Debug.java:242)
at com.candleligth.app.b4xgifview._setgif(b4xgifview.java:49)
at com.candleligth.app.activity2$ResumableSub_Activity_Create.resume(activity2.java:433)
at com.candleligth.app.activity2._activity_create(activity2.java:390)
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:351)
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 com.candleligth.app.activity2.afterFirstLayout(activity2.java:105)
at com.candleligth.app.activity2.access$000(activity2.java:17)
at com.candleligth.app.activity2$WaitForLayout.run(activity2.java:83)
at android.os.Handler.handleCallback(Handler.java:754)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6393)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:933)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
** Activity (activity2) Resume **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
** Activity (activity2) Create, isFirst = true **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
Error occurred on line: 60 (B4XGifView)
java.lang.RuntimeException: Object should first be initialized (ImageView).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:67)
at anywheresoftware.b4a.objects.ViewWrapper.setBackground(ViewWrapper.java:105)
at com.candleligth.app.b4xgifview._setgif(b4xgifview.java:94)
at com.candleligth.app.activity2._activity_create(activity2.java:413)
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:351)
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 com.candleligth.app.activity2.afterFirstLayout(activity2.java:105)
at com.candleligth.app.activity2.access$000(activity2.java:17)
at com.candleligth.app.activity2$WaitForLayout.run(activity2.java:83)
at android.os.Handler.handleCallback(Handler.java:754)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6393)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:933)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
** Activity (activity2) Resume **
I am attaching the source code
 

Attachments

  • candle.zip
    160.8 KB · Views: 49
Last edited:

mangojack

Well-Known Member
Licensed User
Longtime User
Activity2 does not load any layout ... yet you declare the B4XGifView1 here , and in Activity_Create is this...
B4X:
B4XGifView1.SetGif(File.DirAssets, "candldeon.gif")


B4XMainPage loads "MainPage" layout which contains the B4XGifView ...

Declare the View and call the the above in B4XMainPage Class and the problem is solved.
Or load a layout in Activity2 than contains a B4XGifView.
 
Upvote 0
Top