How to get current time format of the android device? i.e. If the android device’s current time format is changed from 12hr to 24 hr format and vice versa, then how to check that setting programatically?
I want to change the time shown in my app widget to be of same format as the device’s and whenever the time format is changed then my widget should also show that time format. Any pointers will be helpful.
thanks.
You can use TIME_12_24.
time_formatwill have 12 or 24 based on the settings.Make sure you have added this permission to manifiest file.
EDIT :
You can also use DateFormat.is24HourFormat(). It doesn’t require an extra permission.