How to pack a config file into my apk package

by Ke Wu » Wed, 21 Apr 2010 18:21:42 GMT

Sponsored Links
 Hi all
     As you know, an app often has some configurations, I need to save these
configurations into a file, and in my app I could change these
configurations. In other words, I need a file to take all my config data,
and in my app, I could read/write this file as I want.

I've searched document and mailing list archive, and have not found the
exact solution.
1. SharedPreferences could not solve : It could only do with simple
key/value pairs, my configuration data is more complex .
2. file in /assets , /res/raw  could not solve: It seems that the file in
these position would be read only

I've found a way, it almost solved my problem, but still not.
Our code could deal with the file in /data/data/package-name/files on the
target file system, this is good to me, but how could I put my file in this
directory after my app has been installed? My app need to read these
configurations when it starts.

So, my question is how could I pack my data file into my apk package, and
then my app could read/write this file when it is run.

Thanks in advance.



Other Threads

1. Finishing all the running activities?


I want to completely exit my application under test in my test code
(ActivityInstrumentationTestCase) before launching each test.

Since there is no exit in an android app. Is there a way I can
traverse through all the activities of an app so that I call Finish()
on each i.e. finish all the activities that have been started.


2. Uploading Screen Shots of App to Android Market

Hello Droiddudes and Droidettes,
I'm having some trouble uploading screenshots via the dashboard.

Although i've followed the rules about 320 x 480 size for screen shots, +
I've used 24 bit PNG, it still is not accepting any of my screenshots.

I've tried everything.

Why isnt it working?

When it says "no borders" - am I meant to remove the part of the screen shot
that contains the time, battery consumption etc? It is basically a screen
capture of the emulator.

I'm really frustrated and I need some help.

Whose idea was it at Google to limit the app description to 335 characters?
Talk about cruel!!

Thanks, and sorry for whining.




3. Updated apps not showing at the top of the list

4. Motorola cliq with Motoblur

5. Release of SAM 3.0

6. pointer location app under emulator

7. The <keygen> tag revisite