onConfigurationChange not called after changing locale onConfigurationChange not called after changing locale android android

onConfigurationChange not called after changing locale


For others who encounter this issue the OP was right but a bit unclear.
You have to define android:configChanges="layoutDirection|locale" in order for onConfigurationChanged() to be called.
I assume that this is necessary because locale change might also affect layout direction (for RTL languages) so declaring just locale might not be enough, yet this is only my assumption on this matter.


You can extend from Application and set it in the manifest.Then, put onConfigurationChanged there, and check if the previous locale is the same as the current one:

if(!_currentLocale.equals(newConfig.locale))  {  _currentLocale=newConfig.locale;  // locale has changed  }

The "_currentLocale" variable should be initialized on the onCreate method of the new class (that extends Application), as such:

  @Override  public void onCreate()    {    super.onCreate();    _currentLocale=getResources().getConfiguration().locale;    }


Use layoutDirection attribute in the manifest file.