title: How does the Android ResultReceiver callback work if it is passed through a Bundle as Parcelable?
body: <p>I have passed a ResultReceiver from my Activity to my Service.</p>
  
  <p><strong>Activity code example</strong> to pass the ResultReceiver to my service so the service can make a callback to the Activity:</p>
  
  <pre><code>ResultReceiver receiver = new ResultReceiver(new Handler()) {
      protected void onReceiveResult(int resultCode, Bundle resultData) {
          //process results
      }
  }
  
  Intent instructionServiceIntent = new Intent(context, InstructionService.class);
  instructionServiceIntent.putExtra("receiver", receiver);
  context.startService(instructionServiceIntent);
  </code></pre>
  
  <p><strong>InstructionService code example:</strong></p>
  
  <pre><code>protected void onHandleIntent(Intent intent) {
      Bundle parameters = intent.getExtras();
      ResultReceiver resultReceiver = parameters.getParcelable("receiver");
      resultReceiver.send(METHOD_STATUS_RUNNING, Bundle.EMPTY);
  }
  </code></pre>
  
  <p>Now, this works fine as when I call the resultReceiver.send method in my service, the corresponding onReceiveResult method in the activity is executed.</p>
  
  <p>My question is, <strong>how</strong> does this work?  As far as I understand, the ResultReceiver is being passed from the activity to the service as a Parcelable, which means its a "copy" of that object, and not a reference to the original ResultReceiver object which was created in the Activity.  Therefore, how can a call to the send method on the copy of the ResultReceiver in the service class, make it so that the original ResultReceiver object in the activity runs it's onReceiveResult method?</p>