Android Question Exception when loading layout

Arf

Well-Known Member
Licensed User
Longtime User
I get an exception when loading a layout on one device - I have run this project on loads of different devices and never seen anything of the sort, but this device is quite small and old - (Samsung DUOS GT-S7562, android 4.0.4). I think the screensize is 480x800.

I see the error is something to do with an image not being able to get loaded into an ImageView, but not certain why it fails to load or how to investigate further. It is quite a large image - 1.8MB, 1268x1490 bitmap.

java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.DynamicBuilder.build(DynamicBuilder.java:21)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:345)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:425)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:144)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:208)
at com.medchipsolutions.spiroconnectmobile.forcedtest._activity_create(forcedtest.java:478)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:697)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at com.medchipsolutions.spiroconnectmobile.forcedtest.afterFirstLayout(forcedtest.java:102)
at com.medchipsolutions.spiroconnectmobile.forcedtest.access$000(forcedtest.java:17)
at com.medchipsolutions.spiroconnectmobile.forcedtest$WaitForLayout.run(forcedtest.java:80)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4517)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: Error loading bitmap.
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize2(CanvasWrapper.java:521)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize(CanvasWrapper.java:499)
at anywheresoftware.b4a.objects.drawable.BitmapDrawable.build(BitmapDrawable.java:69)
at anywheresoftware.b4a.objects.ImageViewWrapper.setImage(ImageViewWrapper.java:90)
at anywheresoftware.b4a.objects.ImageViewWrapper.build(ImageViewWrapper.java:113)
... 28 more
Error occurred on line: 109 (ForcedTest)
java.lang.RuntimeException: java.lang.RuntimeException: Object should first be initialized (ImageView).
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:166)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:208)
at com.medchipsolutions.spiroconnectmobile.forcedtest._activity_create(forcedtest.java:478)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:697)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at com.medchipsolutions.spiroconnectmobile.forcedtest.afterFirstLayout(forcedtest.java:102)
at com.medchipsolutions.spiroconnectmobile.forcedtest.access$000(forcedtest.java:17)
at com.medchipsolutions.spiroconnectmobile.forcedtest$WaitForLayout.run(forcedtest.java:80)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4517)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: Object should first be initialized (ImageView).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50)
at anywheresoftware.b4a.objects.ViewWrapper.innerInitialize(ViewWrapper.java:71)
at anywheresoftware.b4a.objects.ImageViewWrapper.innerInitialize(ImageViewWrapper.java:35)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:406)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:425)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:144)
... 22 more
 

Johan Schoeman

Expert
Licensed User
Longtime User
It seems to be complaining about an imageview that was not initialized in your code
 
Upvote 0

Arf

Well-Known Member
Licensed User
Longtime User
Dankie Johan

Thing is, this view is initialised in the designer (and seems to be init'd fine on most devices, just not this specific one). I've never had this issue on any other devices.
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
Dankie Johan

Thing is, this view is initialised in the designer (and seems to be init'd fine on most devices, just not this specific one). I've never had this issue on any other devices.
Hoop jy kry die probleem uitgesorteer....
 
Reactions: Arf
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…