androidandroid-configchanges

Get the current language of the application not the device Android


So I'am using a button to switch language from english to french !

My problem is that i need to know the language of my current Application only not the language of my device .

I'am using these line of code in order to know the current language

Locale.getDefault().getLanguage()

but Apparently he's returning my device language .

Any help will be appreciated .


Solution

  • Try this:

    getResources().getConfiguration().locale
    

    https://stackoverflow.com/a/12530405/6371926