Reputation: 16808
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?
Upvotes: 3
Views: 7041
Reputation:
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.
Upvotes: 2
Reputation: 34833
You can save it in /res/raw
folder
If you save your file as yourfile.txt
InputStream inputStream = this.getResources().openRawResource(R.raw.yourfile);
Upvotes: 7
Reputation: 4114
As far as I know you can open a .apk with zip and add files. Where is no magic :)
Upvotes: 2