title: onActivityResult For Fragment
body: <p>I currently have a base activity which is hosting a single fragment.  Inside the fragment I have a method which starts the contact chooser.</p>
  
  <pre><code>private void chooseContacts() {
      Intent pickContactIntent = new Intent(Intent.ACTION_PICK,      ContactsContract.Contacts.CONTENT_URI);
      pickContactIntent.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_TYPE);
      startActivityForResult(pickContactIntent, PICK_CONTACT_REQUEST);
  }
  </code></pre>
  
  <p>When this activity returns how should I capture the results.  I have tried adding a </p>
  
  <pre><code>@Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
      //Handle Code
  }
  </code></pre>
  
  <p>to both my base Activity and the fragment but neither method are being triggered.  If possible I would like to have the fragment handle the return so as not to muddy up the activity.</p>
  
  <p>Please let me know what the best practice is in this situation.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>if I change:</p>
  
  <pre><code>startActivityForResult(pickContactIntent, PICK_CONTACT_REQUEST);
  </code></pre>
  
  <p>to</p>
  
  <pre><code>getActivity().startActivityForResult(pickContactIntent, PICK_CONTACT_REQUEST);
  </code></pre>
  
  <p>then it works, but other posts have made me think that is incorrect.</p>