0
我的接收器不点火,下面的代码:广播接收器不点火
AndroidManifest
<recevier android:name=".NoticeReceiver" android:enabled="true">
<intent-filter>
<action android:name="com.clublifestyle.NoticeService.BROADCAST" />
</intent-filter>
</recevier>
NoticeReceiver.java
public class NoticeReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, "ASDASD", Toast.LENGTH_SHORT).show();
}
}
CLMainActivity.java
public class CLMainActivity extends TabActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.main);
this.createTabs();
Intent i2 = new Intent(this, NoticeReceiver.class);
this.sendBroadcast(i2);
}
}
你能帮忙我找出原因? 谢谢!
谢谢,但它仍然不起作用 – 2012-03-03 19:07:20
@kenyi我发现你的问题的来源。在你的清单中,正确的单词是'receiver',而不是你写的'recevier',而现在你的应用程序根本看不到接收器。 – Luksprog 2012-03-03 19:23:16
非常感谢!看起来像Eclipse在这个错字中没有检测到错误。 – 2012-03-03 22:49:11