title: resultCode is always 0
body: <p>I'm trying to get the resultCode to be OK inside my onActivityResult function. However, it keeps coming back as 0. I have spent several days on this, and can't figure out why it doesn't work. Here's my code. If anybody can help me, I'll be very grateful, Thanks.</p>
  
  <p>My Activity1 class:</p>
  
  <pre><code>    private class MyTask extends AsyncTask&lt;String, Void, String&gt; {
          @Override
          protected String doInBackground(String... urls) {
                  // process
              return result;
          }
  
          @Override
          protected void onPostExecute(String result) {
              Intent i = new Intent(Activity1.this, Activity2.class);
              i.putExtra("Value1", "This value one for ActivityOne ");
              i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
              startActivityForResult(i, REQUEST_CODE);
              textView.setText(result);
          }
      }
      @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          if (resultCode == RESULT_OK &amp;&amp; requestCode == REQUEST_CODE) {
                         // do something
                  }
          }
  </code></pre>
  
  <p>My Activity 2 class:</p>
  
  <pre><code>    @Override
      public void finish() {
          Intent data = new Intent();
          data.putExtra("returnKey1", "return 1");
          setResult(RESULT_OK, data);
          super.finish();
      }
  </code></pre>
  
  <p>My manifest:</p>
  
  <pre><code>&lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt;
          &lt;activity android:name=".Activity1"
                    android:label="@string/app_name"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity android:name=".Activity2"
                    android:label="@string/app_dialog_name" 
                    android:launchMode="singleTop" 
                    android:excludeFromRecents="true"
                android:taskAffinity="" 
            android:theme="@android:style/Theme.Dialog"&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  </code></pre>