I have 4 Activities A -> B-> C -> D
from Activity D
I want to go back to B
here is the code
manifest:
<activity android:name=".GetAttendance" android:launchMode="singleTask"/>
.
Activity D
Intent intent = new Intent(AddNewGuest.this, GetAttendance.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra("guest", temp);// temp is an object
setResult(600, intent);
startActivity(intent);
on Activity B
, I am calling:
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
System.out.println("requestCode:"+requestCode+" resultCode:"+resultCode);
}
But I am getting the requestCode
equals to 1000 where it I am sending it 600
However, when Activity B
calls C
and before going to D
I'm setting requestcode to 1000 startActivityForResult(intent, 1000);
any suggestion?
You are sending a requestCode of 1000, which can be seen from your startActivityForResult(intent, 1000);
statement
You were expecting a 600, but the call to setResult(600, intent);
is setting the result code to 600
This is different because you are expecting for a request code , whereas the 600 value is for result code
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.