0
class that creates the timepicker
public class TimePickerFragment extends DialogFragment
implements TimePickerDialog.OnTimeSetListener {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the current time as the default values for the picker
final Calendar c = Calendar.getInstance();
int hour = c.get(Calendar.HOUR_OF_DAY);
int minute = c.get(Calendar.MINUTE);
// Create a new instance of TimePickerDialog and return it
return new TimePickerDialog(getActivity(), this, hour, minute,
DateFormat.is24HourFormat(getActivity()));
}
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
// Do something with the time chosen by the user
}
}
method that calls the timepicker by clicking the button
public void showTimePickerDialog(View v) {
DialogFragment newFragment = new TimePickerFragment();
newFragment.show(getSupportFragmentManager(), "timePicker");
}
See if it resolves: http://stackoverflow.com/a/35203223/2570426
– viana
Not really that, but I see the help
– Demetrius
I did not find anything that solves this there not! I will take another look here.
– viana
Look at this other reply I’ve already given to you.
– ramaral
This answer is to do this with XML, I’m asking how to do the same thing through java code
– Demetrius