Search code examples
androidlocale

How to detect if the language is English (All variants) on Android?


I want to show a button only for English users, is there a way to detect the language settings?

I know how to get the current Locale, but I don't know if comparing it against Locale.English is sufficient, since there must be a lot of English variations etc.

Anyone experience doing this?


Solution

  • Locale.getDefault().getDisplayLanguage() will give your default language of your device
    

    Example

    System.out.println("My locale::"+Locale.getDefault().getDisplayLanguage());
    

    Result

    My locale::English