Friday, July 23, 2010

[android-developers] sendBroadcast() does not work with Intents that have component name set

Whenever I invoked `sendBroadcast()` using an intent with Component
name set, it does not get properly delivered to the destination's
broadcast receiver.

As an example, assume that I have a TargetActivity that registered a
BroadcastReceiver for ACTION1

This will work:

Intent i = new Intent(TargetActivity.ACTION1);
sendBroadcast(i);


This does not:

Intent i = new Intent(TargetActivity.ACTION1);
i.setClassName(this, TargetActivity.class);
sendBroadcast(i);

I also tried i.setClass() with no luck. Is this behavior expected?

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate