在我的应用程序中有一个服务类,需要从该服务类调用一个 Activity 类,但每次调用 Activity 类时它都会向我显示一条消息 应用程序没有响应,下面是我的代码..
public class MyAlarmService_Movie extends Service {
@Override
public void onCreate() {
super.onStart(intent, startId);
Intent in=new Intent().setClass(MyAlarmService.this,Reminder.class);
startActivity(in);
}
}
最佳答案
在开始 Intent 之前给 in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
。
关于android - 如何从服务类调用 Activity 类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5015507/