A DateTimePreference, analogous to DatePreference or TimePreference
-
In Eclipse with your project open:
- In the Package Explorer right click on your project and select "Properties".
- Select "Java Build Path" -> "Libraries".
- "Add External JARs..." then select the DateTimePreference.jar file.
-
In your activity that descends from PreferenceActivity:
import com.unclesunny.datetimepreference.DateTimePreference;
-
In your preference XML:
<com.unclesunny.datetimepreference.DateTimePreference android:key="start_time" android:title="Start Time" />
-
To quickly get the Date and Time selected for "start_time", in your PreferenceActivity:
DateTimePreference.getDateTimeFor( PreferenceManager.getDefaultSharePreferences(this), "start_time");
-
To set the date and time use
.setDateTime(String)
. -
To make the JAR:
With just the DateTimePreference source code loaded in Eclipse:
In the Package Explorer right click on the "default.jardesc" file and select "Create JAR"