My program needs large .txt file to be stored on SD-card (so, I want to redistribute it with .apk, without creation from the program). How I can attach the file (created on PC) to .apk?
Asked
Active
Viewed 6,747 times
3 Answers
7
You can save it in /res/raw
folder
If you save your file as yourfile.txt
InputStream inputStream = this.getResources().openRawResource(R.raw.yourfile);

Labeeb Panampullan
- 34,521
- 28
- 94
- 112
2
It might be slightly easier to use the AssetManager. Just save your files in the assets/ directory (as opposed to res/raw/). Then you can access them directly using their filename. http://developer.android.com/reference/android/content/res/AssetManager.html describes how to access the assets.
2
As far as I know you can open a .apk with zip and add files. Where is no magic :)

programmersbook
- 3,914
- 1
- 20
- 13
-
1I didn't mean this. And anyways, you must sign your .apk before publishing - if you'll modify it, the signatures will not match. – artem Feb 03 '11 at 13:25