How can I store a HashMap <Integer, String> in android using shared preferences? -
i have created hashmap in next way:
hashmap<integer, string> buttons = new hashmap<integer, string>();
i need remain in format, every reply solution have seen works hashmap<string, string>
thanks
hey found way in end :)
i changed hashmap had format , did next save contents:
sharedpreferences.editor editor = getsharedpreferences(prefs_name, 0).edit(); for( entry entry : backupcurency_values.entryset() ) editor.putstring( entry.getkey(), entry.getvalue() ); editor.commit();
and next retrieve hashpmap:
sharedpreferences prefs = getsharedpreferences(prefs_name, 0); for( entry entry : prefs.getall().entryset() ) backupcurency_values.put( entry.getkey(), entry.getvalue().tostring() );
android hashmap sharedpreferences
No comments:
Post a Comment