View an Android App's shared preferences?

android, debugging, preferences, sdk, sharedpreferences

Solution

Run project in emulator, then from Eclipse choose menu Windows-> open perspective ->DDMS. From tab device, choose emulator name, then go to file explorer,expand data->data->yourpackagename, you should see share reference xml file (only work on the emulator or a rooted device). Finally, export this file to windows. See http://developer.android.com/tools/debugging/ddms.html Update: Another way, you can listen shared preference change:

SharedPreferences.OnSharedPreferenceChangeListener prefListener = 
new SharedPreferences.OnSharedPreferenceChangeListener() {
  public void onSharedPreferenceChanged(SharedPreferences prefs,String key) {
if (key.equals("YourKey")) 
     {
          //Get this
     } 
 }

SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);          
preferences.registerOnSharedPreferenceChangeListener(prefListener);

See SharedPreferences.onSharedPreferenceChangeListener not being called consistently

Problem

When I am working on my app in eclipse, is there a way to see the changes I make to the shared preferences of the app while it is debugging in the emulator? Thanks in advance

Original source

Related problems