title: TimePickerDialog to set format according to the device's time system
body: <p>I'm developing a medication reminder android app. I have a problem on how to manipulate the time picker dialog so it will show the time depending on the device's time system. Si if the phone is in 12-hour format the time picker dialog should have am/pm selector. And if it is on the 24 hour format the time shown in time picker are from 00 - 24. </p>
  
  <p>This code below is for 24-hour format. any idea on how to add the 12-hour format? And how to check what time format the phone is using. Thanks </p>
  
  <pre><code>TimePickerDialog.OnTimeSetListener t = new OnTimeSetListener() {
          @Override
          public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
              DecimalFormat df = new DecimalFormat("00");
              timeHour = hourOfDay;
              timeMinute = minute;
              timeS = String.valueOf(df.format(hourOfDay)) + ":" + String.valueOf(df.format(minute));
              timeSelected.setText(timeS);
          }
      };
  </code></pre>