I have 2 activities A and B, A is defined as "singletask" on the manifest launch mode, as it should be and i cannot change this. A launches activity B, then when B clicks the back button i want to launch activity A again, but i want to destroy the previous activity, and create a new instance of A. right now the following code is not working. It just takes me back to the old A activity.
<activity
android:name="A"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@style/AppTheme" />
public void onBackPressed() {
Intent intent = new Intent(this,A.class);
intent.putExtra("newextra1","newextra1");
intent.putExtra("newextra2","newextra2");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
finish();
}