开发者

How to close main class for stopService

开发者 https://www.devze.com 2023-03-16 02:02 出处:网络
I want to close my clas开发者_StackOverflow中文版s for stopService(); , and i am using this method but i know that it\'s false , please help me:

I want to close my clas开发者_StackOverflow中文版s for stopService(); , and i am using this method but i know that it's false , please help me:

if (Main_Page.this.finish() == true){
stopService(svc);
}

Thank you ...


use this

public void onDestroy(){
 super.onDestroy();
 stopService(new Intent(this,yourservice.class));
}


if you want to stop your service .. then do that in onDestroy() call back of your activity

public void onDestroy(){
 super.onDestroy();
 stopService(svc);
}
0

精彩评论

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