开发者

Getting user local setting in Android

I am creating an application which shows some data on the basis of user country. Currently, I am asking the user to select the country an开发者_StackOverflowd then storing it. Is there any way, so that the application can get the user local setting from the device and automatically select the corresponding country for the user?

Thanks Ashwani


Using Locale.getDefault() should be sufficient for determining the user's preferred locale. I would need more information on the nature of your data to determine whether it would be proper to use their preferred locale to determine their country, or whether you should be using the GPS/TelephonyManager to get this info.

See here for more info regarding Locale.

See this similar question for more solutions using TelephonyManager.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜