I have this Android app that\'s localized in several languages. If the appropriate string for the device\'s locale exists, the app automatically displays it. So far, so good.
Locale defaultLocale = Locale.getDefault();
Edit: Sorry, I just realized this does not in fact answer your question, since you're overriding the default to effect your change.
I resolved this issue by storing the existing setting on first run of the app (before any changes are made to the default locale). In a block that only runs the first time my app runs, I call:
m_preferences.edit().putString(
MyConstants.PREFERENCE_SYSTEM_LANGUAGE,
getResources().getConfiguration().locale.getLanguage()
).commit();
Later, when I need to retrieve it:
languageToLoad = m_preferences.getString(
MyConstants.PREFERENCE_SYSTEM_LANGUAGE,
MyConstants.LANGUAGE_DEFAULT);
When changing the language, I save that in another preference and handle the updates to the view.
Edit: After poking around a bit more, I found the system setting. I switched to using this, rather than the above code.
Resources.getSystem().getConfiguration().locale.getLanguage();