This post was flagged by the community and is temporarily hidden.
have you check it after compiled apk? or checking it only in companion?
and one more thing, we cannot show txt file direct, we must have to read it with file component, or simply store your text to any variable and load that after screen initialize.
let me check your aia if i can do anything with that.
Use // for files in assets
Basically / theoretically as Boban said, but:
It’s really hard to get it working, because there are several issues with the File component:
- Sometimes the full path and sometimes the relative is used (see blocks below)
- WRITE permission is not queried automatically (only READ), so you have to ask manually for WRITE permission.
- Permission granted is not triggered when the app starts for the first time, so you have to reload the screen.
- Moreover: the File component can not access the assets with the APK (works only with companion).
It seems to work! I will check this in full project.
Check with APK.
Btw, this returns: file:///android_asset/
which will work only for the webviewer component:
yes this one is working only for web viewer, in companion i can read from file with /Makeroid/Assets/filename.txt, but when it goes to compiled apk, txt files goes to “android_asset/” which is not accessible by files component.
yes, and this is a bug.
Just tried // and it is working fine as apk
Since when? Then this bug is fixed, which I didn’t realize. I’ll check that again.
i am also trying something on his aia, but cant compile apk due to (unknown famous error of these day) unable to compile apk without any reason.
what bug are you taking about?
if you want to read a file from the assets using the file component, you have to use two slashes // followed by the filename, see also the documentation Storage
ReadFrom( fileName )
Reads text from a file in storage. Prefix the filename with / to read from a specific file on the SD card. for instance /myFile.txt will read the file /sdcard/myFile.txt. To read assets packaged with an application (also works for the Companion) start the filename with // (two slashes). If a filename does not start with a slash, it will be read from the applications private storage (for packaged apps) and from /sdcard/AppInventor/data for the Companion.
Taifun
Yes // works! Of course, Reading from the file did not work, but I was able to load the data using KIO4_TintDBX1. I tried using KIO4_GetTinyDB1, but there it didn’t work.
I used this blocks for reading from file
Yes that works, but do you have an idea why it’s not working with copy file from assets?
of course this should be possible and therefore is a bug…
and it should work with //text.txt
in the companion app as well as the apk
now added in the bug list here Bugs in Kodular Eagle
Taifun