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.

kerlw

--



Other Threads

1. My Buttons are not Clickable in the Incall Screen

Hi I have a Querry,
I am trying to add buttons to the Incall screen. But after adding the
buttons, my buttons are not Clickable.
That UI is present in the screen. I am able to select the Buttons
using the up down arrow Key. And on pressing OK control is going to my
OnClickListener

But I am not able to Click the Buttons directly on the UI.
It looks like some kind of Blocking is there for Click events on the
Incall Screen, But still I need to get rid of it. Do suggest. What
the possible way?

My code is as follows.

public class InCallScreen extends Activity
        implements View.OnClickListener, View.OnTouchListener,
                CallerInfoAsyncQuery.OnQueryCompleteListener {
..
..
    private Button mEndCall;
     mEndCall = (Button) findViewById(R.id.EndCall);
     mEndCall.setOnClickListener(new View.OnClickListener(){
     public void onClick(View v) {
     PhoneUtils.hangup(mPhone);
     //handle the click and End Control here
}});

Thanks and regards
Zealousian

--~--~---------~--~----~------------~-------~--~----~

2. Email configuration error

I am getting following error during email settings for gmail account
using inbuilt Email.apk application (android 1.5-r1 version):
nable to open connection to the server
Any help will be greatly appreciated.

I am using following settings:
Incoming settings-
IMAP server: imap.gmail.com
Port: 993
Security type: SSL (always)

After giving above incoming setting, pressing Next button. Then it
start checking for incoming settings and I got error nable to open
connection to the server
Outgoing settings-
SMTP server: smtp.gmail.com
Port: 465
Security type: SSL (always)

Thanks in advance,
Devendra

--~--~---------~--~----~------------~-------~--~----~

3. AlertDialog.Builder don't close on PositiveButton click

4. ListView Doubt : Listen to clicks inside a ListView Item

5. ListView Query

6. Problems when I try to make menuconfig

7. Google Maps application problem - tiles not loading = grey background only / Maps API key available