1

I have Activity A and called from it Activity B. In manifest Activity A has configChanges android:configChanges="locale|orientation|screenSize".

In Activity A - for changing locale

@Override
public void onConfigurationChanged(Configuration newConfig)
{
    super.onConfigurationChanged(newConfig);
    Resources res = this.getResources();
    res.updateConfiguration(newConfig, null);
    Intent intent = getIntent();
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
    startActivity(intent);
}
  • for starting Activity B

    Intent intent = new Intent(this, B.class); startActivity(intent);

If I start Activity A and change locale all is working fine. But if I try to start Activity A, then start Activity B and after that go to Activity A and change locale, Activity A will not be restarted, it will be destroyed. How can I prevent Activity A from being destroyed?

user2017548
  • 63
  • 1
  • 5

1 Answers1

0

Add the flag Intent.FLAG_ACTIVITY_REORDER_TO_FRONT to your Intent. It will reorder an existing Activity from the stack if it is already running.

Steve Benett
  • 12,843
  • 7
  • 59
  • 79
  • In Activity A - for changing locale @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); Resources res = this.getResources(); res.updateConfiguration(newConfig, null); Intent intent = getIntent(); intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent); } - for starting Activity B Intent intent = new Intent(this, B.class); startActivity(intent); – user2017548 Aug 08 '13 at 08:52