How to include data files with the app's APK?

Xarph picture Xarph · Nov 30, 2010 · Viewed 54.9k times · Source

I want to create some pre-created files when my Android application is installed.

I would like to create the file in both the internal memory (data/data//files/) and in a newly created sdcard directories (/sdcard//data1/).

How can I do this?

Answer

Labeeb Panampullan picture Labeeb Panampullan · Nov 30, 2010

You can save you files in \res\raw and write the code to store this files to the desired locations if it does not exist when the app start.
Check this to access the internal memory and sdcard
and access the raw file using the following

InputStream databaseInputStream = getResources().openRawResource(R.raw.yourfile);