Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You haven't clearly stated you're question. You want to understand how to pass a result back from an Activity to the Activity which called it. You must first understand that Activities aren't hierarchical even though they are kept on a back stack. Later activities do not <em>belong</em> to the Activity they are called from.</p> <p>However, here is the answer the question you meant to ask:</p> <p>You are using <code>startActivityForResult(Intent, int)</code> (Which you can read up on <a href="http://developer.android.com/reference/android/app/Activity.html#StartingActivities" rel="nofollow">here</a>)</p> <p>When <code>Activity A</code> calls <code>startActivityForResult()</code> method <code>Activity B</code> is started, this should do whatever processing is required and then when it exits either call:</p> <pre><code>setResult(RESULT_OK) </code></pre> <p>when a yes/no is required or</p> <pre><code>setResult(RESULT_OK, intent) </code></pre> <p>where intent is an <code>Intent</code> which contains bundled information you want to use in <code>Activity A</code> to act upon. After <code>Activity B</code> exits <code>Activity A</code> will resume and call the method:</p> <pre><code> protected void onActivityResult(int requestCode, int resultCode, Intent data) </code></pre> <p>This is where you will process the result. </p> <p>You can read all about this here:</p> <p><a href="http://developer.android.com/reference/android/app/Activity.html#StartingActivities" rel="nofollow">http://developer.android.com/reference/android/app/Activity.html#StartingActivities</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload