I am trying to get the current device locale with the region like \"en_us\",\"en_gb\".
I am calling Locale.getDefault().getLanguage()
and it returns only th
Format like "en_us" or "en_gb" has "language code"_"country code"
A Locale object contains both country code and language code.
So you can use below snippet to format your own code..
String cCode = Locale.getDefault().getCountry();
String lCode = Locale.getDefault().getLanguage();
String code = lCode+"_"+cCode;
or
you can use toString()
method on Locale object to get the data
String code = Locale.getDefault().toString();