Android: stopService in another Activity

前端 未结 5 477
有刺的猬
有刺的猬 2020-12-20 19:57

How can I stop my Service in another Activity?

I start the service in my summaryActivity

SocketServiceIntent = new Intent(this, SocketService.class);         


        
5条回答
  •  南方客
    南方客 (楼主)
    2020-12-20 20:19

    You should call Activity(ContextWrapper)#stopService:

    stopService(new Intent(SummaryActivity.this, SocketService.class));
    

提交回复
热议问题