Save and write to text or csv file

I want to make an app in which user can save some text data and if required then update them.
and even there is another app in which user can import these data. so I need to save these text data to a file txt/csv in sd card or somewhere locally so user can import the file in another app!

so can someone help me with some blocks?

I want to create a folder or file in “/storage/emulated/0/” but when I create directory “storage/emulated/0/myfolder”
It creates a directory in “android/data/package name/files” and then “storage/emulated/0/myfolder/”

Note: I’m currently using android12

May be this is not possible. Android 10+ you must try to use ASD as mentioned in the above post by @bodymindpower . Detailed guide was added by them … you can check it out.

Can I access another applications app specific directory by any chance??

Actually I need to use a shared file between two apps!

one app should generate the file and another app should read it!
and one more thing is the file is very important, so if the user clears app data the file should remain in the same place!

Have you checked this extension?

Else why don’t you try some online storage applications like gsheet, baserow, airtable?? It depends upon your expectation…

1.Is this SharedDB an online database?
No, It works using the SharedPreferences class like the TinyDB does. Your data is stored on

the device and will be cleared once uninstalled or if they clear the application data.

I may used sharedDB but if user uninstall or clear app data then all my data will be gone.

and i am not using online storage because I want to make the application fully offline

Then please be wait till Some other kodular who uses the same technique like you to reply…

Shareable offline app

As for i know, if user uninstall the app, all the data will be erased… anyhow let we wait… Android 10 above , i m not sure it will access specific folder for read and write… in such case if user deletes that folder accidentally what would happen?

What about reading the link by @bodymindpower to find out, that you only can create folders in shared storage or ASD?
BTW the mentioned extension SharedDB does not work anymore after SDK30…

Taifun

2 Likes