I have a TimePicker set in the 24 hour format. I have tried something like this in the onCreate() method of my activity class that uses it, but it doesn't seem to keep the time I change when I back out and reload the activity. Is something wrong with this? Do I need to "submit" the time, if so how?
final TimePicker t = (TimePicker) findViewById(R.id.timePicker);
t.setIs24HourView(true);
t.setHour(prefs.getInt("hour",15));
t.setMinute(prefs.getInt("min",15));
t.setOnTimeChangedListener(new TimePicker.OnTimeChangedListener() {
public void onTimeChanged(TimePicker view, int hourOfDay, int minute) {
editor.putInt("hour",hourOfDay);
editor.putInt("min",minute);
}
});
Are you doing this- editor.commit()?