1

maybe my question is a little stupid but I couldn't find this answer.

What I'm doing is a backup of the APNs list. I want to store the APNs list in a file. I already have the list of APNs but I want to store this list not as database but as a file. Also this file needs to be read by my device to load all the list eventually. Any one can guide me in the right direction?

Thanks!

4

1 に答える 1

0

Good news, you can use normal Java I/O facilities on Android. As well as Android-specific ones. You will need to decide whether to use external storage (SD card) or internal, or maybe shared preferences.

For the Java I/O, you'l need to know how to associate Java streams with files. For things such as shared preferences, there are specific APIs.

You could start from a good overview here. The concepts are there, as well as the keywords to google further:

http://www.vogella.com/articles/AndroidFileBasedPersistence/article.html

(Note that Environment.getExternalStorageDirectory() is the right approach, while hardcoded paths such as /sdcard or /mnt/sdcard, which you can find in some top-ranked examples, are wrong.)

于 2012-11-12T15:27:19.560 に答える