我的搜索沒有讓我找到任何解決方案,也許更簡單讓我的代碼無法正常工作。無法發送意向BroadcastReceiver
我的活動javapage包含這個裏面的OnCreate:
Intent MyCountryCodeIntent = new Intent(this,OutgoingCallReceiver.class);
MyCountryCode = "01";
MyCountryCodeIntent.putExtra("code",MyCountryCode);
即使我設置startActivity(MyCountryCodeIntent);
或sendBroadcast(MyCountryCodeIntent);
這個應用程序掛起
我OutgoingCallReceiver.class頁面包含這個裏面的onReceive:
Bundle bundle = intent.getExtras();
if(null == bundle) return;
String MyCountryCodeIntent=intent.getStringExtra("code");
可能是錯的,但我找不到什麼..
您應該指定一個「意願行動」,而不是使用直接意圖廣播。因此,名稱「廣播」。 – RvdK 2013-04-22 09:01:08