I'm trying to look for a solution to change the title on a TimePicker dialog. Right now it says whatever the system time is (ex. "12:23 AM") but I want to change this to something a little more descriptive. Does anyone have any suggestions?
By request. :)
By TimePicker dialog do you mean the actual TimePickerDialog? Because that has a
setTitle(CharSequence text)
method. The TimePickerDialog is what is used in the official tutorial. http://developer.android.com/reference/android/app/AlertDialog.html#setTitle(java.lang.CharSequence)
This question is rather old, but it shows up on Google results if you search this question. So, I thought I'll post my solution.
DatePicker
has setCustomTitle(View view)
, where you can define your own view (e.g. TextView
with your custom text) to be used as a title. This one does not update when changing values.
I dont know how to reply to the comments below question, so I use "Answer". By looking into source code: SourceCode
You may realize that OnTimeChangedListener is implemented by TimePickerDialog. To avoid title changed while adjusting time, you may derived from TimePickerDialog and override public void onTimeChanged(TimePicker view, int hourOfDay, int minute);
Notice, dont call super version, or it will setTitle again...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With