In my case, there isn't actually a data exchange at all. This is
actually setting my app's Preferences. This is the relevant code:
//////// Activity A
// Button Listeners
accountButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent i = new Intent(A.this, UserPass.class);
startActivityForResult(i, Wherester.USER_CREATE);
}});
//////// Activity B
@Override
protected void onActivityResult(int request, int result, Intent i){
super.onActivityResult(request, result, i);
Log.i("UserPass","Returning from User Create"); // Note, this line
is NEVER seen
// Just returned from creating a user
if(request == App.USER_CREATE && result == RESULT_OK){
// User has successfully registered, go back to main screen
setResult(RESULT_OK);
finish();
}
}
// Button for B
signupButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent nextScreen = new Intent(B.this, C.class);
startActivityForResult(nextScreen, App.USER_CREATE);
}});
////////// Activity C
// Button in C
signupButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
setResult(RESULT_OK);
finish();
}});
On Oct 23, 12:20 am, Saltedfish <[EMAIL PROTECTED]> wrote:
> by your means ,I make these codes:
> if you want to pass a intent data from C to A,you should first set
> the intent data as the result for B.
> then B set the intent data as reasult for A in B's onActivityResult()
> function.
> like this:
>
> //C Activity:
> //button press for pass intent data to A
> Intent ctoadata;
> setResult(RESULT_OK , ctoadata);
> finish();
>
> //B Activity:
> //receive the result from C,then pass the result to A
> protected void onActivityResult(int requestCode, int resultCode,
> Intent data)
> {
> if(resultCode==RESULT_OK)
> {
> setResult(RESULT_OK , data);
> finish();
>
> }
>
> }
>
> //A Acitivity
> //receive the result from B, now the data equals C.ctoadata intent
> data.
> protected void onActivityResult(int requestCode, int resultCode,
> Intent data)
> {
> if(resultCode==RESULT_OK)
> {
> //data==C.ctoadata
> //do other.....
> }
>
> }
>
> if your codes like these,it should be successful.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---