tags:

views:

57

answers:

3

Hi,

How can I add/delete/modify values in "default.properties" for Android.

Any examples?

Thanks, Sana.

A: 

Why do you want to modify those values? If you're trying to change what version of the API you're building against, that can be done in the "android" section of the project properties in Eclipse...

QRohlf
I think I am thinking too much, I had posted a question to know if we can find out when we loaded an app for the first time, hence was thinking to change the properties file with some other value other than the default value and decide accordingly.
Sana
+1  A: 

How can I add/delete/modify values in "default.properties" for Android.

I use a text editor.

This answer was probably obvious to you, suggesting that your real question is not the one I quoted above, but rather something else you did not include here. If you find that your StackOverflow question is less than, say, 150 words, your question is probably too short. Give us more context, such as what you are trying to achieve.

CommonsWare
What I meant was, can we through the code access the default.properties file and add/delete/modify rows to it?
Sana
`default.properties` is used by build tools. It does not exist on the device. You are welcome to modify build scripts to modify this file.
CommonsWare
A: 

Hi, what i read from your comment is that you want to check if an Application was run for the first time.

Use Android preferences for that:

Check if some value occurs in SharedPreferences

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    int value = prefs.getInt("FirstRun"), -1); 

If it first run do what you want:

if(value == -1){
  // do sth
  SharedPreferences.Editor editor = prefs.edit();
  editor.putInt("FirstRun", 1);
  editor.commit();
 }
pixel
Excellent answer and this WORKS wonders!Thanks a ton!
Sana