Debug Sharedpreferences on Android

Asked

Viewed 55 times

1

Is there any easy way to see everything inside my SharedPreferences?
Something like for example:

SharedPreferences prefs = this.getSharedPreferences( "user_access", Context.MODE_PRIVATE);
Log.i("SharedPreferences", prefs);

Update
With the help of @Piovezan I managed using the following code:

SharedPreferences prefs = this.getSharedPreferences( "user_access", Context.MODE_PRIVATE);
Map<String, ?> prefs_map = prefs.getAll();

Log.i("debug", prefs_map.toString());
  • 2

    If you look at The Sharedpreferences API, You’ll see there’s a dodo getAll() that returns a Map with the key-value pairs contained in the preferences.

  • @Piovezan, why don’t you put it in answer? To me it answers the question.

1 answer

4


If you look at The Sharedpreferences API, You’ll see there’s a dodo getAll() that returns a Map with the key-value pairs contained in the preferences.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.