android - not found activity to handle broadcast intent -
android - not found activity to handle broadcast intent -
this code isn't work. happen?
public class main extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); registerreceiver(br, new intentfilter("a.b.c.d")); intent = new intent("a.b.c.d"); startactivity(it); } broadcastreceiver br = new broadcastreceiver() { @override public void onreceive(context context, intent intent) { toast.maketext(context, "test", toast.length_short); } }; }
error:
01-22 10:55:21.812: error/androidruntime(10405): java.lang.runtimeexception: unable start activity componentinfo{sample.intent.broadcast/sample.intent.broadcast.main}: android.content.activitynotfoundexception: no activity found handle intent { act=a.b.c.d }
if trying test receiver, replace startactivity(it)
sendbroadcast(it)
.
android
Comments
Post a Comment