I want to edit shared preferences values from DDMS, if I double click the file it doen't saves the changes. Do I do something wrong or there is special plugin for that?
Android stores Shared Preferences settings as XML file in shared_prefs folder under DATA/data/{application package} directory. The DATA folder can be obtained by calling Environment. getDataDirectory() .
SharedPreferences are stored in an xml file in the app data folder, i.e. SharedPreferences added during runtime are not stored in the Eclipse project. The default shared preferences file would actually be: /data/data/<package>/shared_prefs/<package>_preferences.
Unlike commit() , which writes its preferences out to persistent storage synchronously, apply() commits its changes to the in-memory SharedPreferences immediately but starts an asynchronous commit to disk and you won't be notified of any failures.
A SharedPreferences object points to a file containing key-value pairs and provides simple methods to read and write them. Each SharedPreferences file is managed by the framework and can be private or shared. This page shows you how to use the SharedPreferences APIs to store and retrieve simple values.
First, you should probably make sure your app isn't running before doing this.
You have to use the File Explorer option. Navigate to
data -> com.yourpackage -> shared_pref
Click the xml and at the top right click pull
.
Edit the xml on your computer.
Once you're done, click push
(also top right).
If you pushed the same file to the same device to the same directory, the next time you launch the app, you should see your updated values.
Just follow the steps, it is easy.
Step 1:
Step 2: Open data/data/you package name/shared_prefs -> select your shared pref -> right click and give Save As.
Step 3: Save in your desired folder. I am saving in desktop folder. Dont change the name
Step 4: Now edit the needed values in the saved file.
Step 5: Upload the edited file to shared_pref directory
Finally close and open the app to make it work. That's all.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With