2013-04-24 66 views
1

我想從onReceive()開始一個活動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); 

回答

2

試試這個

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

謝謝Anuj.It解決了問題 – 2013-04-24 06:47:34

0

嘗試

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

然後

Intent(this, NearbyFriends.class);