Home » Android » android – Changing the title on a TimePicker?

android – Changing the title on a TimePicker?

Posted by: admin June 15, 2020 Leave a comment


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?

How to&Answers:

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.


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…