Example usage for android.content SharedPreferences getAll

List of usage examples for android.content SharedPreferences getAll

Introduction

In this page you can find the example usage for android.content SharedPreferences getAll.

Prototype

Map<String, ?> getAll();

Source Link

Document

Retrieve all values from the preferences.

Usage

From source file:Main.java

public static void dumpCurrentSharedPrerence(SharedPreferences pref) {
    Map<String, ?> map = pref.getAll();
    Iterator<String> ite = map.keySet().iterator();
    while (ite.hasNext()) {
        String key = ite.next();//from ww w .  j a  v a2 s  .  c  om
        Log.d(TAG, "dump " + key + " : " + String.valueOf(map.get(key)));
    }
}

From source file:Main.java

public static Set<String> getLockedApps(Context c) {
    SharedPreferences sp = appsPrefs(c);
    return new HashSet<>(sp.getAll().keySet());
}

From source file:Main.java

public static Map<String, ?> getAll(Context context, String file_name) {
    SharedPreferences sp = context.getSharedPreferences(file_name, Context.MODE_PRIVATE);
    return sp.getAll();
}

From source file:Main.java

public static Map<String, ?> getAll(Context context) {
    SharedPreferences sp = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE);
    return sp.getAll();
}

From source file:Main.java

public static String findKeyInPrefs(SharedPreferences prefs, String value) {
    for (Map.Entry<String, ?> entry : prefs.getAll().entrySet()) {
        if (value.equals(entry.getValue())) {
            return entry.getKey();
        }/*from  ww w  .j av  a 2  s . c  o  m*/
    }
    return null; // not found
}

From source file:Main.java

public static Map<String, ?> getAll(Context context) {
    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
    Map<String, ?> prefsMap = preferences.getAll();
    return prefsMap;
}

From source file:Main.java

public static Map<String, ?> getAll(Context context) {
    SharedPreferences sp = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE);
    Map<String, ?> allKeyValue = sp.getAll();
    return allKeyValue;
}

From source file:Main.java

public static Map<String, ?> getObjAll(Context context, String path) {
    SharedPreferences sharedPreferences = context.getSharedPreferences(path, Activity.MODE_PRIVATE);
    Map<String, ?> map = sharedPreferences.getAll();
    return map;/*from   ww  w .j a v a2  s  .  com*/

}

From source file:Main.java

public static Map<String, ?> ReadSharedPreferences(Context context, String name) {
    SharedPreferences userInfo;
    try {/*from  www.  j  a  v  a 2s .  c om*/
        userInfo = context.getSharedPreferences(name, Context.MODE_WORLD_READABLE);
        return userInfo.getAll();
    } catch (NullPointerException e) {
        return null;
    }
}

From source file:com.emobc.android.profiling.Profile.java

public static List<NameValuePair> createNamedParameters(Context context) {
    List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
    SharedPreferences settings = getProfileData(context);
    Map<String, ?> map = settings.getAll();
    for (String key : map.keySet()) {
        final String value = map.get(key).toString();
        if (value != null && value.length() > 0) {
            nameValuePairs.add(new BasicNameValuePair(key, value));
        }//from   ww  w  .j  a v  a  2s.c  o  m
    }
    return nameValuePairs;
}