Android Question Imageview Exception

joergb

Member
Licensed User
Longtime User
Maybe it's solved, but then I don't find it

I have a simple Mediaplayer App and it works fine on Android 10 with a Item SDK Version 28 in the Manifest Editor.
Now I copied the App on an old Phone with Android 4.3 , it doesn't work. I change the Manifest Editor MIN Sdk Version to 4 and starts the project in a Debug Session .
Load Layout throw an Exception "btPlay not initialized" btPlay is a Imageview an the Bitmap is assigend in the Designer.
I remove the Bitmap-Items in Designer and try to assign at runtime ... I get the same Exception (Imageview not Initialized)
Now I don't assign any Bitmaps, I have only white ImageView's without Images ... and the App runs fine.

I updated B4A from version 10.5 to 10.6 without any change.

A prior Version of B4A or SDK or whatelse was able to start it. I found an old app , build with an old version of B4A and I can see these Bitmaps.

Any Idea ?
It's not really important for a simple Mediaplayer on an old Smartphone to play MP3-files in my garage, but maybe it can be important for another App that has to run on an old Version.
 
Some features are only available in Android 5 or higher.
It depends of what exactly you are using in your app. ALL of this must be compatible with SUCH OLD Androids.
 
Upvote 0
Thanks for your replays

Here are the Log:
[CODE lang="b4x" title="Log"]*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at anywheresoftware.b4a.DynamicBuilder.build(DynamicBuilder.java:38)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:349)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:453)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:148)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
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.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at bis.bumbum.main.afterFirstLayout(main.java:105)
at bis.bumbum.main.access$000(main.java:17)
at bis.bumbum.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5419)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
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:539)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize(CanvasWrapper.java:517)
at anywheresoftware.b4a.objects.drawable.BitmapDrawable.build(BitmapDrawable.java:69)
at anywheresoftware.b4a.objects.ImageViewWrapper.setImage(ImageViewWrapper.java:101)
at anywheresoftware.b4a.objects.ImageViewWrapper.build(ImageViewWrapper.java:124)
... 27 more
Error occurred on line: 59 (Main)
java.lang.RuntimeException: java.lang.RuntimeException: Object should first be initialized (ImageView).
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
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.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at bis.bumbum.main.afterFirstLayout(main.java:105)
at bis.bumbum.main.access$000(main.java:17)
at bis.bumbum.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5419)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
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:67)
at anywheresoftware.b4a.objects.ViewWrapper.innerInitialize(ViewWrapper.java:73)
at anywheresoftware.b4a.objects.ImageViewWrapper.innerInitialize(ImageViewWrapper.java:36)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:434)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:453)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:148)
... 21 more
[/CODE]

and the b4a code is the
Activity.LoadLayout("mplay")
in the Sub Activity_Create
and it crashes at first time.

and, as described above, it's an old software , I create it for years to use an old smartphone in my garage as mp3 player. Now I want to change a little bit, use the new b4a and it chrashes.
 
Upvote 0
Back
Top