I have two language in my app. values/strings.xml and values-ru/strings.xml When I programmatically change language, all strings translating, b
Finally got a solution:
Get resouce Id
of the activity's title from PackageManger
, and set the AcionBar
's title to the resource id, this time because the Locale is already changed android knows which activity title to pick.
try{
ActivityInfo activityInfo = getPackageManager().getActivityInfo(getComponentName(),
PackageManager.GET_META_DATA);
ActionBar actionBar = getActionBar();
if(actionBar != null)
actionBar.setTitle(activityInfo.labelRes);
}catch (PackageManager.NameNotFoundException ex){
Log.e(this.getClass().getSimpleName(),
"Error while getting activity info. " + ex.getMessage(), ex);
}