Posts

Showing posts from March, 2018

Android Preferences Time Picker

When developing the preferences page for an Android app you can add a time picker with this class. import android.content.*; import android.content.res.*; import android.preference.*; import android.util.*; import android.view.*; import android.widget.*; import java.text.*; import java.util.*; /* * Use in preferences.xml like this: *   <net.intrepidis.library.prefs.TimePreference *       android:key="mytime_preference" *       android:title="@string/mytime_preftitle" *       android:summary="@string/mytime_prefsummary" *       android:defaultValue="00:10" *       positiveButtonText="@string/ok_button" *       negativeButtonText="Close me" /> */ public class TimePreference extends DialogPreference { private final Calendar calendar; private final TimePicker p...