我想结束我的类stopService();
,我用这个方法,但我知道那是假的,请大家帮帮我:如何关闭主类stopService
if (Main_Page.this.finish() == true){
stopService(svc);
}
谢谢...
我想结束我的类stopService();
,我用这个方法,但我知道那是假的,请大家帮帮我:如何关闭主类stopService
if (Main_Page.this.finish() == true){
stopService(svc);
}
谢谢...
使用本
public void onDestroy(){
super.onDestroy();
stopService(new Intent(this,yourservice.class));
}
如果你要停止你的服务..然后做在的onDestroy()调用回你的活动
public void onDestroy(){
super.onDestroy();
stopService(svc);
}
谢谢,但是当我用onDestroy svc无法解析变量时。 –
你应该使用stopService(this,yourservice.class); – Sujit
yup ..你应该使用stopService(this,yourservice.class),但记住一个服务只能停止,如果停止服务与你开始它相同的上下文。 –
谢谢,这是工作。 –