The simple answer: there is no other way. Here's how to do it in Android. The only thing that I think you are missing is to pass the request code to action B. Without it, you cannot distinguish which other result of the activity returned to activity A.
If you call different actions from your A, use the different requestCode parameter when using the requestCode function. Alternatively, you can pass any data back to action B using the same Intent approach (normal, almost any):
public final static int REQUEST_CODE_B = 1; public final static int REQUEST_CODE_C = 2; ... Intent i = new Intent(this, ActivityB.class); i.putExtra(...);
Then in on ActivityResult :
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch(requestCode) { case REQUEST_CODE_B:
OnActivityResult is executed in the GUI thread, so you can do whatever updates you want right here.
Finally, in Activity B you should:
Intent resultIntent = new Intent(); resultIntent.putExtra(...);
I'm not sure why you need AsyncTask process the results.
source share