Reputation: 111
I have an Android Watch Face that works for 12-hour formats. I am confused how to implement a 24-hour format based on the system preference of the phone, using TextClock or any other method.
SimpleDateFormat twelvehour = new SimpleDateFormat("h:mm a", Locale.US);
String TimeAmPmNoSec = String.format("%s", twelvehour.format(cal.getTime()));
canvas.drawText(TimeAmPmNoSec, (centerX - (timeXLength / 2.0f ), timeYOffset, timePaint);
Upvotes: 0
Views: 206
Reputation: 19044
That setting is bridged from your phone to the watch automatically and you can get it on your watch app by calling DateFormat.is24HourFormat(context)
.
Upvotes: 2