开发者

How to call An activity class from a service class

开发者 https://www.devze.com 2023-02-10 15:17 出处:网络
In my app there is a service class and need to call an activity class from that service class,but it each time while calling the acti开发者_如何学编程vity class its show me a message that

In my app there is a service class and need to call an activity class from that service class,but it each time while calling the acti开发者_如何学编程vity class its show me a message that application is not responding ,and below is my code..

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);
    }
}


Give in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); before starting the intent.

0

精彩评论

暂无评论...
验证码 换一张
取 消