Activity_A calls Activity_B (startActivity() and when _B calls finish(); both activities close. I’m adding FLAG_ACTIVITY_NEW_TASK, I tried using startActivityForResult without any luck.
Activity_A is a TabActivity
Activity_B is an Activity
Activity_B is being called from Activity_A like:
public boolean onContextItemSelected(MenuItem item) {
// code removed...
Intent mViewIntent = new Intent(Activity_A.this, Activity_B.class);
mViewIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mViewIntent.putExtra("ID", MY_IDS.get(position));
this.startActivity(mViewIntent);
// code removed...
}
I know that when I call the same routine from within onItemClick() everything works as I expect, a new activity is started for Activity_B, if finish() is called or the user presses back, the program returns to Activity_A. It seems that from within onContextItemSelected() the flag for new_task is being ignored or something else is wrong that I’m not understanding. Please help me figure out this issue!
As far as my understanding of your problem goes, I do not see why you should use
mViewIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);.See the documentation for FLAG_ACTIVITY_NEW_TASK.