How to get the user preferred units? (metric (meters) or imperial (miles))?

Although there isn't a way to get the preferred units using Locale, you can assume by default that if the Locale indicates the United States or Myanmar (locale.getISO3Country().equalsIgnoreCase("usa") || locale.getISO3Country().equalsIgnoreCase("mmr")) the preferred units are imperial, otherwise the preferred units are metric. In any case where units may be shown in either imperial or metric form, the measurement system shown should be a user-settable preference.

There are certain idiosyncrasies involving units in some countries. (See also the accepted answer at the time of this writing.) For example, although the preferred everyday units in the United Kingdom are metric units, there are some exceptions, notably—

  • miles and miles per hour, in ground transportation;
  • miles per hour, in wind speeds;
  • pints and gallons, for milk and beer (but not most other foods and beverages); and
  • stone, or stone and pounds, for a person's weight.

Since some people outside the US may have set the language to English (US) it is eventually better to take the return value of getSimCountryIso() instead of getISO3Country()

TelephonyManager tm = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
String countryCode = tm.getSimCountryIso();

If the countryCode is us the SIM card is an american and therefore imperial units might be the better choice - in any other case the metric system is applied


I don't think there's necessarily a correct answer to the Metric/Imperial question for all locales.

For example, in the UK we generally use miles for large distances like a car journey, feet and inches for people's height but may use meters to describe the dimensions of a room.

We almost always use litres for measuring liquid volume except for beer and sometimes milk which can still be sold in pints.

Kilograms are usually preferred to pounds and ounces but most recipe books will list both since some people still have scales which use the latter.

I think you will have to do some research to find out which countries use which scale for what you're interested in measuring (and of course, give the user the option to select one or the other manually.)