Android Question reading a file in the root of internal memory

rogel a. tolentino

Member
Licensed User
using the command bellow
Msgbox(File.ReadString(File.DirRootExternal, "String.txt"), "string.txt")
I viewed the content of string.txt located at the root of external sd of an android phone

I tried this command
File.WriteString(File.DirInternal, "String.txt", "This is some string" & CRLF & "and this is another one.")
then
Msgbox(File.ReadString(File.Dirinternal, "String.txt"), "string.txt")
No error and the content of string.txt displayed
But I can not find the String.txt in an internal storage of an android phone
Where can I locate string.txt
 

Peter Simpson

Expert
Licensed User
Longtime User
Please use code tags when posting code, it makes for easier reading.


Also there's no reason to create multiple posts about the same topic or issue or to bump up a post on this forum, someone will most probably answer your question sooner rather than later anyway...
 
Last edited:
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
B4X:
File.WriteString(File.DirInternal, "String.txt", "This is some string" & CRLF & "and this is another one.")

This statement creates a file in the app's internal memory. This memory area is internal to the app and, unless your 'phone is rooted, you will not be able to see it or to access it from any other app, or from any connected device, like a PC.

B4X:
Msgbox(File.ReadString(File.Dirinternal, "String.txt"), "string.txt")

This statement, running in your app, is able to access the file that you have just written.

If you want to write files that can be accessed by other apps, or transferred to another device, like a PC, use "File.DirExternal". The files will be in a folder as follows ...

/sdcard/Android/data/<package name>/files ...
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…