Code example for PreferenceScreen

Methods: setSummary

0
    private void updateScheduleSummaries() { 
        Calendar c = Calendar.getInstance();
        PreferenceScreen ps = (PreferenceScreen) findPreference("schedulestart");
        c.set(Calendar.HOUR_OF_DAY, getScheduleStartHour());
        c.set(Calendar.MINUTE, getScheduleStartMinute());
        ps.setSummary(DateFormat.getTimeFormat(this).format(c.getTime()));
        ps = (PreferenceScreen) findPreference("schedulestop");
        c.set(Calendar.HOUR_OF_DAY, getScheduleStopHour());
        c.set(Calendar.MINUTE, getScheduleStopMinute());
        ps.setSummary(DateFormat.getTimeFormat(this).format(c.getTime()));
    } 
 
    private int getScheduleStartHour() { 
        return getPreferenceManager().getSharedPreferences().getInt("schedulestarth",
                DEFAULT_SCHEDULE_START_HOUR);
    } 
 
    private int getScheduleStartMinute() { 
        return getPreferenceManager().getSharedPreferences().getInt("schedulestartm",
                DEFAULT_SCHEDULE_START_MINUTE);
    }