Answers for "send data preference android studio"

1

get preference value android

boolean mBoolean = PreferenceManager.getDefaultSharedPreferences(yourContext).getBoolean(key, defaultValue); //getBoolean will return defaultValue is key isn't found
//you can also use getInt, getFloat, getLong, getString, getStringSet and change the variable type, of course
Posted by: Guest on March-16-2020
0

android key value pair

Map <Integer,String> myMap = new HashMap<Integer,String>();

Iterator<Entry<Integer, String>> iterator = myMap.entrySet().iterator();
while (iterator.hasNext()) {
    Map.Entry<Integer,String> pairs = (Map.Entry<Integer,String>)iterator.next();
    String value =  pairs.getValue();
    Integer key = pairs.getKey();
    System.out.println(key +"--->"+value);
}
Posted by: Guest on November-05-2020

Code answers related to "send data preference android studio"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language