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. iPhone SDK lacks mapping function read this post's title correctly.  The iPhone SDK lacks the
basic mapping API required by application developers hoping to tie the
mobile experience to a geo-specific location.  The only mapping
function provided by the iPhone SDK is to send a URL to the iPhone's
built-in Google map application and to let Google handle the rest.

I learned this while researching the iPhone SDK in comparison to the
Android OS.  I wanted to determine how difficult it would be to port
Pocket Journey to the iPhone.  As it turns out, the port could never
happen as it couldn't for the majority of the apps submitted to the
Android Challenge.

If you want, you can read more about this discovery here:



2. Load a class from another .apk file dynamic?

I want to develop an application, it was form by plugins.
Then I need to load a class from plugin.
Use Class.forName() to load a class from the same apk file, it's
successful, but if the class is in another apk file, the method throw
How to load the class from another apk file?


3. Creating an XML file from Code

4. ROMs for Current Hardware?

5. Starting Google NotePad by firing Intent

6. How to dinamically change the activity that is launched when selecting the app icon?

7. About Hardware Requirements