1

我想从 的onReceive()方法启动一个 Activity BroadcastReceiver,但 ActivityNotFound每次都会发生异常。请检查并告诉我我的代码有什么问题

    <activity android:name="NearbyFriends"></activity>

    <receiver android:name="AlarmManagerBroadcastReceiver"/>

调用另一个活动的代码是

    Intent intent1 = new Intent(); 
    Intent1.setClassName("com.android.letscatchupclientside","com.android.letscatchupclientside.NearbyFriends");
    intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent1);
4

2 回答 2

2

尝试这个

Intent intent1 = new Intent(context, NearbyFriends.class); 
intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent1);
于 2013-04-24T05:49:59.820 回答
0

尝试

<activity android:name="com.android.letscatchupclientside.NearbyFriends"></activity>

然后

Intent(this, NearbyFriends.class);
于 2013-04-24T05:49:00.440 回答