Android 2.2:启动时自动启动应用程序问题
@Override
public void onReceive(Context context, Intent intent) {
Intent myIntent = new Intent(context, YourActivity.class);
context.startActivity(myIntent);
}
我创建了一个扩展 BroadCastreciever 的类。我希望它在启动时运行我的主类,但当我启动设备时,我不断收到“强制关闭”消息。我认为问题出在“YourActivity.class”。
我尝试过“TestMain.class”(我的主类名称)和“com.test.Testmain.Class”。我错过了什么吗?
谢谢
@Override
public void onReceive(Context context, Intent intent) {
Intent myIntent = new Intent(context, YourActivity.class);
context.startActivity(myIntent);
}
I have made a class that extends BroadCastreciever. I want it to run my main class on startup, but i keep getting the "force close" message when i boot my device. I think the problem is located at "YourActivity.class".
I have tried with "TestMain.class" (my main class name) and "com.test.Testmain.Class". Did i miss something?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果你想在启动时启动它,我会按照这个例子。
自动启动应用
I would follow this example if you want to start it up on boot up.
Auto Start app