artem
artem

Reputation: 16808

Adding file to .apk

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

Answers (3)

user458577
user458577

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

Labeeb Panampullan
Labeeb Panampullan

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

programmersbook
programmersbook

Reputation: 4114

As far as I know you can open a .apk with zip and add files. Where is no magic :)

Upvotes: 2

Related Questions