My app collects data which it stores in arrays, and I need to be able to access the data from outside the app. The tablet I am using has no SD card, so I'm thinking the best way to transfer data would be to save to 'external' system memory. I have found tutorials to save data on internal storage and for specific data types like pictures onto SD cards, but I can't figure out how to write an arbitrary file to an arbitrary location. Thanks.
Asked
Active
Viewed 144 times
2 Answers
1
This sounds like a perfect time to use a SQLite
database. Android comes with SQLite
support built in so its easy to set up. You can just create a database and store your array data there (you can even store pictures too as a byte[]). There are a number of tutorials that show how to do this. Here is 1 and 2. It should be pretty easy from there.

Rarw
- 7,645
- 3
- 28
- 46
-
Thanks! Once data are saved in external memory, would it be accessible from the file browser when I plug it into a computer? – Lableable Aug 01 '13 at 17:23
-
Yes you can get the database off the phone - see [here](http://stackoverflow.com/questions/4452538/android-location-of-sqlite-database-on-the-device) and [here](http://stackoverflow.com/questions/4467999/how-to-access-the-sqlite-database-in-android). Alternativly you can build a file and store it to the build in storage as you were suggesting. This can be done both with and without the database but the database makes it possible to use the information easily on the phone and get it off the phone if you need to. – Rarw Aug 01 '13 at 17:26
-
I could get away with building the files myself if it's easier. Would I still need to use the content provider to bring data outside of the app? That's the part that's confusing me right now. – Lableable Aug 01 '13 at 17:34
-
You mean like [this](http://stackoverflow.com/questions/14140612/save-file-in-the-internal-storage-of-android-device) heres an example that works w/o an SD card – Rarw Aug 01 '13 at 17:44
0
I'm not sure that you can write to an arbitrary place on the Android system. You could write to a file in /data/data// and then email that file to yourself.

Karim Varela
- 7,562
- 10
- 53
- 78