[英]How to close main class for stopService
我想為stopService();
,我正在使用這種方法,但我知道這是錯誤的,請幫助我:
if (Main_Page.this.finish() == true){
stopService(svc);
}
謝謝...
如果你想停止你的服務..然后在你的活動的 onDestroy() 回調中做到這一點
public void onDestroy(){
super.onDestroy();
stopService(svc);
}
用這個
public void onDestroy(){
super.onDestroy();
stopService(new Intent(this,yourservice.class));
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.