在BroadcastReceiver中启动活动

时间:2013-04-24 05:47:28

标签: android android-intent broadcastreceiver

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

ActivityNotFound

和调用其他Activity的代码是

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

    <receiver android:name="AlarmManagerBroadcastReceiver"/>

2 个答案:

答案 0 :(得分:2)

试试这个

Intent intent1 = new Intent(context, NearbyFriends.class); 
intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent1);

答案 1 :(得分:0)

尝试

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

然后

Intent(this, NearbyFriends.class);