title: onActivityResult is not called even though setResult is called
body: <p>I have an activity holding fragment (<code>MainActivity.java</code>) inside in and the fragment (<code>ItemFragment.java</code>) has recyclerview that shows some of items. When an item is cliked, It starts an activity (<code>ViewActivity.java</code>) for result. However, onActivityResult method in (<code>MainActivity.java</code>) is not called. Here is my codes</p>
  
  <p><strong>OnClick method in ViewHolder class that starts new activity when an item is clicked</strong></p>
  
  <pre><code>@Override
  public void onClick(View v) {
        Intent i;
  
        // activity is an instance of AppCompatActivity class (MainActivity.java)
        i = new Intent(activity, ViewActivity.class);
  
        activity.startActivityForResult(i, SyncTask.REQ_CODE);
  }
  </code></pre>
  
  <p><strong>Codes in ViewActivity that sends result</strong></p>
  
  <pre><code>@Override
  public boolean onOptionsItemSelected(MenuItem item) {
          ....
          resultData=new Intent();
          resultData.putExtra(SyncTask.KEY_ACTION, action);
          resultData.putExtra(SyncTask.KEY_POSITION, m.getAdapterPosition());
  
  
          setResult(Activity.RESULT_OK,resultData);
          finish();
  
          return true;
  }
  </code></pre>
  
  <p><strong>onActivityResult method in <code>MainActivity.java</code></strong></p>
  
  <pre><code>@Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      int action;
      int[] positions;
  
      if (requestCode == SyncTask.REQ_CODE) {
          if (resultCode == Activity.RESULT_OK) {
              // Handle action
  
          }
      }
  }
  </code></pre>
  
  <p><strong>Manifest file</strong></p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.example.app"
  android:versionCode="1"
  android:versionName="1.0" &gt;
  
  &lt;uses-sdk
      android:minSdkVersion="14"
      android:targetSdkVersion="21" /&gt;
  &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
  &lt;uses-permission android:name="android.permission.READ_PHONE_STATE"/&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&gt;
  
  &lt;application
      android:allowBackup="true"
      android:icon="@drawable/ic_launcher"
      android:label="@string/app_name"
      android:theme="@style/AppTheme" &gt;
      &lt;activity android:name=".activity.MainActivity" android:theme="@style/AppTheme.NoActionBar" 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:theme="@style/Theme.AppCompat.Light" android:name=".activity.PreferencesActivity"&gt;&lt;/activity&gt;
      &lt;activity android:theme="@style/AppTheme.NoActionBar" android:name=".activity.SignInActivity" android:label="@string/sign_in"&gt;&lt;/activity&gt;
      &lt;activity android:theme="@style/AppTheme.NoActionBar" android:name=".activity.ViewMailActivity"&gt;&lt;/activity&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p></p>