Adding files to the APK to be placed in app folder.

Put your problem here if it does not fit any of the other categories.

Adding files to the APK to be placed in app folder.

Postby chand81 » Thu Apr 10, 2008 3:07 pm

Greetings,

How can I add files to the apk so that they are installed to the application directory when installed?

For e.g. I have some images that are read by the application using
mContext.openFileInput("splash.jpg")
splash.jpg has been manually placed into the app directory (data/data/com.cdp.testapp/files) of the emulator using DDMS file explorer.

If I need to distribute the apk, how to handle such dependencies?

Thanks for your help in advance.
chand81
Freshman
Freshman
 
Posts: 3
Joined: Thu Apr 10, 2008 2:50 pm

Top

Postby Jesmiatka » Thu Apr 10, 2008 3:36 pm

Hi,

Why didn't you post these under the resources/drawable directory?
This way you could approach them using getResources().getDrawable(R.drawable.<name>); or @drawable/<name> in XML
This way they are saved in your apk aswell
Jesmiatka
Senior Developer
Senior Developer
 
Posts: 164
Joined: Mon Feb 04, 2008 3:37 pm
Location: Netherlands

Postby chand81 » Thu Apr 10, 2008 6:39 pm

Thanks for the solution. It helped me to find a workaround.

- open the file as an asset using the asset manager
- write it to the application directory first time the application is run.
chand81
Freshman
Freshman
 
Posts: 3
Joined: Thu Apr 10, 2008 2:50 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 19 guests