Reputation: 6884
I would like to use a TimePickerDialog to enter a length instead of a time,
So I would use the same functionalities of a TimePicker but without the PM/AM and to be able to select more than 24 hours
Thanks!
SDK: 2.1
Upvotes: 1
Views: 1508
Reputation: 9373
Why not just use spinners?
//Hour Spinner Values
String[] hours = { "1", "2", "3", "4", "5", "6",
"7", "8", "9", "10", "11", "12" ... "24" };
//Hour Spinner
final Spinner hourspinner = (Spinner) layout.findViewById(R.id.hourspinner);
ArrayAdapter adapter = new ArrayAdapter(this,
android.R.layout.simple_spinner_item, hours);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
hourspinner.setAdapter(adapter);
hourspinner.setSelection(mHour);
You can make spinner for Days/Hours/Minutes/Seconds and then do whatever you need with values taken from the spinners. You can get the value by:
String hourvalue = hourspinner.getSelectedItem().toString();
And you could contain them in a custom alertdialog if you want to emulate a similiar feel to the popup that TimePickerDialog has.
Upvotes: 2