title: Passing parameters to BroadcastReceiver subclass - Android
body: <p>Pass additional parameters to a dynamically registered BroadcastReceiver.</p>
  
  <p>The problem is basic: I want to pass parameters to a BroadcastReceiver. Can this be done? Even when the receiver is created dynamically? </p>
  
  <p>Additionally, say I create an anonymous BroadcastReceiver i.e. as a variable implementation. Can I reference the encapsulating class variables? Check the code below for how I stop / start the file observer.</p>
  
  <pre><code>        // Create the external media broadcast receiver.
          mExternalMediaBroadcastReceiver = new BroadcastReceiver() {
              @Override
              public void onReceive(final Context context, final Intent intent) {
                  // if action = media removed, stop the file observer.
                  EncapsulatingFragment.this.mFileObserver.stopWatching()
              }
          };
  </code></pre>
  
  <p>Is this valid?</p>