TimePickerDialog with Neutral button

Viewed 1118

I have a TimePickerDialog preference with a "TimePreference" class which extends DialogPreference:

public class TimePreference extends DialogPreference{
...
private TimePicker picker=null;

...
public TimePreference(Context ctxt, AttributeSet attrs){
    super(ctxt, attrs);
    setPositiveButtonText(android.R.string.ok);
    setNegativeButtonText(android.R.string.cancel);
}

@Override
protected View onCreateDialogView(){
    picker=new TimePicker(getContext());
    return(picker);
}
...
}

I would like to add a third button, which will set the preference to the current time and close the dialog, like this:

enter image description here

The question is, is there some way of doing this using TimePickers or should I make a custom AlertDialog?

2 Answers
Related