I have an application with three layouts.
According to the android documentation if you use the FLAG_ACTIVITY_CLEAR_TOP flag in the intent to return to the top activity, and the activity has it's launch mode set to 'standard' you should get a new instance of the activity. This will load the different layout that was set in preferences.
I get this behaviour in the android emulator running 4.2.2 without using any flags except FLAG_ACTIVITY_CLEAR_TOP. In my Nexus 7 also running 4.2.2 I never get a new instance and get the old layout unless I quit and restart the app.
I have tried adding 'android:launchMode="standard"' to the manifest and the FLAG_ACTIVITY_NEW_TASK flag to the intent with no change.
Here is an extract from the manifest and the code snippet that should restart it.
<activity
android:name="org.billthefarmer.accordion.MainActivity"
android:label="@string/app_name"
android:launchMode="standard"
android:screenOrientation="portrait" >
  <intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
  </intent-filter>
</activity>
Code from the class:
case android.R.id.home:
    // app icon in action bar clicked; go home
    Intent intent = new Intent(this, MainActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(intent);
    return true;
Is there a better way of achieving this or am I missing something?
 
     
     
    