title: Third activity called returns its result to the first activity instead of sending the result to the second activity?
body: <p>Scenario:</p>
  
  <ol>
  <li>First activity starts seconds activity with startActivityForResult</li>
  <li>Second activity starts third activity with startActivityForResult</li>
  </ol>
  
  <p>Expected result:
  Third (last) activity sets a result which is caught on the <strong>second</strong> activity's onActivityResult</p>
  
  <p>Current result:
  Third (last) activity sets a result which is caught on the <strong>first</strong> activity's onActivityResult</p>
  
  <p>How can I set a result on the third activity which will be caught on the second activity's Third (last) activity sets a result which is caught on the second activity's onActivityResult?</p>
  
  <p>Some code snippets:</p>
  
  <p><strong>First activity</strong></p>
  
  <pre><code>public class TestProjActivity extends Activity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      //setContentView(R.layout.main);
  
      Log.i("TAAAG", "1st activity - startActivityForResult");
      Intent intent = new Intent(TestProjActivity.this, Activ2.class);
      intent.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
      startActivityForResult(intent, 1008);
  }
  
  @Override  
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {  
      super.onActivityResult(requestCode, resultCode, data);
      Log.i("TAAAG", "1st activity - onActivityResult");
      if (resultCode == RESULT_OK) {  
          Log.i("TAAAG", String.valueOf(requestCode));
          switch (requestCode) {  
          case 1008:
              String info = data.getExtras().getString("KEY1");
              Log.i("TAAAG", "1st activity - onActivityResult - printing result");
              Log.i("TAAAG", info);
              break;
          }
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p><strong>Second activity</strong></p>
  
  <pre><code>public class Activ2 extends Activity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      Log.i("TAAAG", "2nd activity - startActivityForResult");
      Intent intent = new Intent(Activ2.this, Activ3.class);
  
      startActivityForResult(intent, 1009);
  
      Intent intent2 = new Intent();
      intent2.putExtra("KEY1", "VALUE1");
  
  
      setResult(RESULT_OK, intent2);
      finish();
  }
  
  @Override  
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {  
      super.onActivityResult(requestCode, resultCode, data);
      Log.i("TAAAG", "2nd activity - onActivityResult");
      if (resultCode == RESULT_OK) {  
          Log.i("TAAAG", String.valueOf(requestCode));
          switch (requestCode) {  
          case 1009:
              String info = data.getExtras().getString("KEY2");
              Log.i("TAAAG", "2nd activity - onActivityResult - printing result");
              Log.i("TAAAG", info);
              break;
          }
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p><strong>Third activity</strong></p>
  
  <pre><code> public class Activ3 extends Activity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      Log.i("TAAAG", "3rd activity - Inserting Value and finishing");
  
      Intent intent = new Intent();
      intent.putExtra("KEY2", "VALUE2");
  
      setResult(RESULT_OK, intent);
      finish();
  }
  </code></pre>
  
  <p>}</p>