9

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?

NickF
  • 5,637
  • 12
  • 44
  • 75

2 Answers2

7

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).

enter image description here

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.

A--C
  • 36,351
  • 10
  • 106
  • 92
  • @NickF I'm pretty sure that this is the only way. If you don't like the GUI, you can also use `adb pull/push` along with the file path. – A--C Feb 16 '13 at 18:53
  • 1
    @NickF also worth noting that DDMS' file explorer will definitely work for emulators, but if you're on a phone, your mileage may vary. From what I can recall, to get the files to show in DDMS, you need to do some permissions changes, which requires root. – A--C Feb 16 '13 at 19:04
  • What is file explorer? Can I do this using Ecplipse? – Buksy Mar 08 '14 at 22:01
  • 1
    @Buksy This is all done using Eclipse. Open the `DDMS` perspective and there should be a tab called `File Explorer`. – A--C Mar 08 '14 at 22:06
6

Just follow the steps, it is easy.

Step 1:enter image description here

Step 2: Open data/data/you package name/shared_prefs -> select your shared pref -> right click and give Save As.

enter image description here

Step 3: Save in your desired folder. I am saving in desktop folder. Dont change the name enter image description here

Step 4: Now edit the needed values in the saved file.

Step 5: Upload the edited file to shared_pref directory enter image description here

Finally close and open the app to make it work. That's all.

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Swathi
  • 1,544
  • 1
  • 13
  • 9