tags:

views:

59

answers:

1
+1  Q: 

Intent on Android

Hi all,

I want a clarification on intent.this is my scenario,there are 3 activities in my project namely "A","B","C"..... On clicking the button in Activity "A" ,i pass the values to "B" through bundle and based on the received value i retrieved set of values from database...Similarly "B"->"C" also...

The problem when i clicked the back button in "C" it does not proceed to "B" rather throws a error.similarly "B" to "A" also....

i found the reason that "B" can not get value from bundle when clicking Back button from "C"

Hope you understand.what's the solution....

Thanks in advance

A: 

Try starting our Activity using startActivityForResult and use setResult(int) to send the result back from Activity C to B

Rahul
You'll also need to check the result code for being equal to RESULT_OK(-1) as it will be RESULT_CANCELED(0) when the back key is hit before you try to retrieve and extras from the Intent. To be doubly safe check that the Intent isn't null. AND you'll need to use setResult(int ResultCode, Intent data) when returning, not just the setResult(int Result Code)
NickT
for 'retrieve and extras', read 'retrieve any extras'. -typo, sorry
NickT