I have four activities, say A, B, C and D. My situation is A will start the activity B by startActivityForResult.
startActivityForResult(new Intent(this,B.class),ONE);
In another situation I will start activity B with a different request code, like:
startActivityForResult(new Intent(this,B.class),TWO);
In B, I need to call C or D depending on requestCode. I.e if ONE need to start C else D.
So I need to know how to check the requestCode in the child Activity (B here).
In other words, I want to get the request code that Activity B was started with.
You can pass request code by put extra.
Or if you have used
startActivityForResult
many times, then better than editing each, you canoverride
thestartActivityForResult
in yourActivity
, add you code there like thisSo there is no need to edit all your startActivityForResult
Hope it helped you