简体   繁体   中英

Android - Where to save text files to?

I'm building an Android app with Adobe AIR that lets user import and export .txt files. What is the best folder to use as a default path to save the .txt files to?

Thanks

You should save the file on the external SD card. Just create an own directory under Environment.getExternalStorageDirectory() that is named like your app and save them all in there. This is pretty much the convention.

You can save the txt wherever you want. I would recommend you to try to save any file in the external memory, and if that fails, then into the phone memory.

best path would be /data/data/your packagename/files/somefile.txt

This location is private to particular app.

You have two options

  • Save it in External phone storage like SD Card. This however will be visible to all users and applications as well. Users can delete it without you knowing about.

Next option is

  • Save it in internal phone storage, here no users and applications can access these files(unless if phone is rooted). But these files will be deleted one's the user selectes clear data from Settings -> Apps -> .

You will need to decide which options wieghs better and accordingly select an appropriate location to save them

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM