title: Alternatives to startActivityForResult
body: <p>Edit: changed Fragment to Partial, I was ignorant of the Fragment object when I wrote this.</p>
  
  <p>I have a partial that contains a button to bring up the contact list.  Doing this requires calling</p>
  
  <pre><code>startActivityForResult( new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI), MY_REQUEST_CODE );
  </code></pre>
  
  <p>and handling the result in my Activity, something like:</p>
  
  <pre><code>public void onActivityResult( int requestCode, int resultCode, Intent data ) {
      if (resultCode == RESULT_OK) {
          switch (requestCode) {
              case MY_REQUEST_CODE: {
                  Address address = contact_address( data );
                  if (address != null) {
                      // do something with address
                  }
              } break;
          }
      }
  }
  </code></pre>
  
  <p>Depending on how I include that partial in my Activity layout, it may be several layers deep in other partials, and there may be more than one instance of the partial.  </p>
  
  <p>I would like to avoid propagating the ID of MY_REQUEST_CODE all the way down to the partial that invokes the activity - or any variation thereof, like assigning an onClickListener to the button - I don't want the top level UI to care about how the partial is constructed at all.</p>
  
  <p>Is there a standard way of achieving this?  It seems to me that if onActivityResult could be made to accept Uri's instead of int codes, the propagation could have been avoided.  I hope I am missing something obvious here...</p>