Monday, April 15, 2013

[android help] Nested set activity for result android

Nested set activity for result android - Stack Overflow



















I have 3 activities. A,B and C. A calls B, B calls C, and the result of C should be received in A. Can you please suggest how to go about it?? I m killing B using finish() after it calls C. So, the result of C should go directly to A Activityonresult. Is it possible??. Please give your suggestions!


























Don't kill B, in A start activity B using startActivityForResult and in B start activity C using startActivityForResult then in B onActivityResult



@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent)
{
super.onActivityResult(requestCode, resultCode, intent);

setResult(RESULT_OK, intent);
finish();
}


where intent is the intent sent back from C. Now A will receive this intent in A onActivityResult.


























What if you call C from A? Something like: A calls B; instead of calling C from B, finish it and make A call C.


Unless the result of C affects B. In such case you have no choice but handling the result of C in B, and set the result of A from there if needed.




















default






.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...