Amit Pal
Amit Pal

Reputation: 11052

Get the result of startActivityForResult method in another activity?

I am using a Google place picker API as follow:

PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();
startActivityForResult( builder.build((Activity) context), PLACE_PICKER_REQUEST );

Now, I am getting the expected result in onActivityResult() method:

protected void onActivityResult( int requestCode, int resultCode, Intent data ) {
  if( requestCode == PLACE_PICKER_REQUEST && resultCode == RESULT_OK ) {
        displayPlace( PlacePicker.getPlace( data, this ) );
    }
}

Process of the activity and intent is

MapActvity -> Place picker intent -> MapActivity 

Instead of getting back to MapActivity after calling startActivityForResult can I directly move to another activity and collect the result in onActivityResult() of another activity?

Upvotes: 0

Views: 482

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006664

No, sorry, this is not possible. The startActivityForResult() and onActivityResult() methods are paired; the call to startActivityForResult() always delivers its results to the same activity (or fragment) that made the call.

Upvotes: 1

Related Questions