9

I am developing an application in which i want to show time picker to set a time for reminder. Right now I am able to show a time-picker using preference screen like this

<org.example.android.TimePreference
 android:defaultValue="12:00"
 android:key="check_time"
 android:summary="Set your desired time for check"
 android:title="Check time" />

TimePreference.java file is inherited from this TimePicker in PreferenceScreen link. But I want to show this on button click in particular activity and set it values in EditText or in TextView. I don't want to use preferences.

So, I want to make the layout of this screen like below image.

enter image description here

halfer
  • 19,824
  • 17
  • 99
  • 186
Juned
  • 6,290
  • 7
  • 45
  • 93

2 Answers2

1

My answer is depending on the API level you are working with.

API level < 11: You'll have to backport the NumberPicker by copying it's source in your project and modifying it to your needs

API level >= 11: You can use the standard implementation of the NumberPicker and extend it to your needs.

Ben Weiss
  • 17,182
  • 6
  • 67
  • 87
1

Please have a look at this tutorial . you will get the project over there . http://www.zainodis.com/2011/05/android-custom-timepicker.html

have a look at this example number picker.. like this you can change it into for time picker. Android Number Picker Dialog

Community
  • 1
  • 1
itsrajesh4uguys
  • 4,610
  • 3
  • 20
  • 31
  • File doesn't exists in your first link, can you provide me that source if you have ? – Juned Apr 08 '13 at 05:46
  • do you have source code of your first link which you mentioned in your answer,it would be great if you can provide me :) – Juned Apr 16 '13 at 05:40