Android Question [solved] TextEditor - getting it to work Android 7 and earlier

Dave O

Well-Known Member
Licensed User
Longtime User
Can someone tell me why the TextEditor example from Erel doesn't seem to work on Android 7 or earlier? (I'm using GenyMotion emulators at the moment, will also try soon with an old tablet I can dust off.)

When I run the app and try to open a file, I get this log output:
B4X:
error extracting information from file provider
(RuntimeException) java.lang.RuntimeException: Object should first be initialized (Cursor).
** Activity (main) Resume **
(FileNotFoundException) java.io.FileNotFoundException: /storage/emulated/0/Download/Camino.csv (Permission denied)

Works fine on Android 8+.

Background:
My app has a function to import CSV files, and it's misbehaving on older Android devices (7.0 and earlier). So I looked for a more modern way of dealing with files (because of all the permission restrictions of more recent Android releases).

I tried the TextEditor example linked above (compiled using B4A 13.00), and found that while it worked fine on Android 8+, it failed on older Android releases. I need something that works on Android 5+.

The only change I made in the TextEditor code was updating the target SDK to 34 to get rid of the warning.

If someone can point me to file-loading code that works on all Android releases back to 5.0, that would be great. Thanks!
 

LucaMs

Expert
Licensed User
Longtime User
I just installed that example, on Android 7 smartphone, without any problems.
Note: I am not using the latest version of B4A but the second to last.

1.jpg
 
Upvote 0

Dave O

Well-Known Member
Licensed User
Longtime User
@LucaMs Thanks for testing this.

I got home and tried it on an old Samsung tablet running Android 5.02, and it worked fine, so it must have been something in the emulator setups that messed it up. All the real devices I've tried have worked, so I'll marked this as solved.
 
Upvote 0
Top