I am trying to start an activity B from activity A with intent set to Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK now i want to get back some data from Activity B to Activity A, and for that i am using startactivityforresult now the problem happening is that, when i am calling setresult from Activity B then my activity A's onactivityresult is not getting called.
Can anyone please tell me why is this happening, and if it is not possible to use startactivityforresult with (NEW_TASK and CLEAR_TASK) then what can i try instead of this.
Also I am trying to use above two intents because i want to clear my back stack when i want to open activity B.
In Activity A
Intent intent = new Intent(A.this, B.class);
Bundle args = new Bundle();
args.putString("from", "A");
intent.putExtras(args);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivityForResult(intent, 111);
On Activity B
Intent resultIntent = new Intent();
resultIntent.putExtras(data.getExtras());
setResult(Activity.RESULT_OK, resultIntent);
finish();