Quick and dirty Custom Preferences

in the activity onCreate…
SharedPreferences prefs = getPreferences(MODE_PRIVATE);
timePicker.setCurrentHour(prefs.getInt("hour",10));
timePicker.setCurrentMinute(prefs.getInt("min",0));
in the activity onDestroy…
SharedPreferences.Editor editor = getPreferences(MODE_PRIVATE).edit();
 editor.putInt("hour", timePicker.getCurrentHour());
 editor.putInt("min", timePicker.getCurrentMinute());    	 
 editor.commit();

One thought on “Quick and dirty Custom Preferences

Comments are closed.