Ok.

Thanks a lot.

2011/5/9 Mark Murphy <mmur...@commonsware.com>

> On Mon, May 9, 2011 at 9:42 AM, Paula Gabriela <paul...@gmail.com> wrote:
> > Well.. I'm sorry if I misunderstood what you said, but I register my
> > broadcast receive in my app2.
> >
> > In my APP2 I have:
> >
> > //APP2
> > String myAction = ..;
> > IntentFilter filter = new IntentFilter();
> > filter.addAction(myAction);
> > this.registerReceiver(receiver, filter); //<--this line right here
> >
> > where my receiver is defined as:
> > //APP2
> > private BroadcastReceiver receiver= new BroadcastReceiver() {
> >     @Override
> >     public void onReceive(Context context, Intent intent) {
> >         Log.w(TAG,"intent received");
> >     }
> > };
>
> This is not a public class.
>
> > In fact, when I try to start my activity (my class the has my receiver)
> like
> > this:
> >
> > //APP1
> > Intent intent = new Intent();
> > intent.setComponent(new ComponentName(pkgApp2, clsApp2));
> > startActivity(intent);
> >
> > it works very well.
>
> An Activity is not a BroadcastReceiver.
>
> You can only use setComponent() and ComponentName if the receiver is
> registered in the manifest, or *maybe* if it is a public class
> registered via registerReceiver(). Right now, you are trying to send a
> broadcast to the Activity, and an Activity is not a BroadcastReceiver.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> Android Training...At Your Office: http://commonsware.com/training
>
> --
> 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+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to