Android Question 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!
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…