I'm working with the timepicker dialouge here but for some reason which i don't understand, i couldn't change the mode of the time picker
to that of AM_PM mode
I have tried the code timepicker.setIs24HourView(false);
Here is my code
onCreate(..){
button.onClickListe..(new...(){
showTimePickerDialog();
});}
public static 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
return new TimePickerDialog(getActivity(), this, hour, minute,
true);
}
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
view.setIs24HourView(false);//TODO not working <-------- This code is not working here
setTimeString(hourOfDay, minute, 0);
timeView.setText(timeString);
}
}
`private void showTimePickerDialog() {
DialogFragment newFragment = new TimePickerFragment();
newFragment.show(getFragmentManager(), "timePicker");
}`}