Time Picker
TimePickerDialog tpd = new TimePickerDialog(this,
new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay,
int minute) {
txtTime.setText(hourOfDay + ":" + minute);
//---------do this i want AM/PM--------------
String am_pm = "";
Calendar datetime = Calendar.getInstance();
datetime.set(Calendar.HOUR_OF_DAY, hourOfDay);
datetime.set(Calendar.MINUTE, minute);
if (datetime.get(Calendar.AM_PM) == Calendar.AM)
am_pm = "AM";
else if (datetime.get(Calendar.AM_PM) == Calendar.PM)
am_pm = "PM";
String strHrsToShow = (datetime.get(Calendar.HOUR) == 0) ? "12": datetime.get(Calendar.HOUR) + "";
st_hour.setText(strHrsToShow + "");
st_minute.setText(datetime.get(Calendar.MINUTE) + "");
st_am.setText(am_pm + "");
//-----------------------------------------------
}
}, mHour, mMinute, false);
tpd.show();