Android Question ExternalStorage

RB Smissaert

Well-Known Member
Licensed User
Tryning run the example posted by Erel:
https://www.b4x.com/android/forum/t...access-sd-cards-and-usb-sticks.90238/#content

I connect to a Samsung S9 via the bridge app.
When I press the Run button (F5) in the IDE, I get this error message:

Error occurred on line: 103 (Main)
java.lang.RuntimeException: Object should first be initialized (Exception).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50)
at anywheresoftware.b4a.objects.B4AException.getMessage(B4AException.java:21)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at anywheresoftware.b4a.BA$1.run(BA.java:325)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

The application runs on the phone, but when selecting a folder on the SD card with .JPG images only the last file in that folder can be displayed. Clicking any other file doesn't give an error, but nil happens.

In my IDE line 103 shows actually End If, so that won't be the problem.

The right libraries are ticked in the library manager:
ContentResolver(1.50)
Core(8.00)
JavaObject(2.05)

Any idea what the problem is here?


RBS
 

RB Smissaert

Well-Known Member
Licensed User
> Error occurred on line: 103 (Main)
> java.lang.RuntimeException

This has gone now. I think I missed a file in the project folder that was in the posted .zip file.
Still, the ImageView1 only shows the last file in the folder. Clicking files doesn't alter that.
I checked all the file names with Log and that is all fine. Also, I can't Catch any error.

RBS
 
Upvote 0

RB Smissaert

Well-Known Member
Licensed User
I did step through the code, but I couldn't see the problem. Clicking the list items shows the right file names in the IDE. Whatever list item I click, the last file in the folder gets displayed in the ImageView1. I am running your unaltered example. Just puzzling.

RBS
 
Upvote 0

DonManfred

Expert
Licensed User
Upvote 0
Top