I have a class that `extends DialogFragment` and inside this class I'm using the `TimePickerDialog`.

The time picker works but the problem is sometimes the `CANCEL` and `OK` buttons don't show, as shown in the images below.

**The buttons work but are invisible.**

Here is the code used for the time picker.

```
public static class TimePickerFragment extends android.support.v4.app.DialogFragment
        implements TimePickerDialog.OnTimeSetListener {

    // String used to set both Start and end times
    String startEndTime;

    @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);

        Bundle b = getArguments();

        if (b != null) {
            startEndTime = b.getString("startEndTime");
        }

        // 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
        switch (startEndTime) {

            case "startTime":

                break;

            case "endTime":

                break;

            default:

                break;

        }

    }
}

public void showTimePickerDialog(String startEndTime) {

    TimePickerFragment timePickerFragment = new TimePickerFragment();

    Bundle b = new Bundle();

    b.putString("startEndTime", startEndTime);

    timePickerFragment.setArguments(b);

    timePickerFragment.show(context.getSupportFragmentManager(), "timePicker");

}

```

[![enter image description here](https://i.stack.imgur.com/aEMq4.jpg)](https://i.stack.imgur.com/aEMq4.jpg)
[![enter image description here](https://i.stack.imgur.com/Y7J01.jpg)](https://i.stack.imgur.com/Y7J01.jpg)