I'm opening the send menu from a button click in a particular activity:
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_TEXT, "meh");
try {
startActivity(Intent.createChooser(i, "pfft"));
} ...
Works fine, but when hitting "Back" to close it, logcat says
Activity com.android.internal.app.ChooserActivity has leaked IntentReceiver com.android.internal.app.ResolverActivity$1@405ab288 that was originally registered here. Are you missing a call to unregisterReceiver()?
Nothing else happens - the app continues to run without a problem.
Searching says that apparently the above code has registered a BroadcaseReceiver and it needs to be unregistered (via unregisterReceiver), probably during onResume (or onPause). The signature for unregister receiver says the single argument should be a BroadcastReceiver instance (makes sense).
My question is - where is the reference to the BroadcastReceiver? AFAICT the methods used to open the menu don't return a BroadcastReceiver - how do I find and reference the appropriate one to unregister it?
TYIA
(should note that I'm debuging on a Samsung Galaxy SII, and this thread indicates it might be a device-specific bug?)