Android: How to safely unbind a service

后端 未结 8 950
深忆病人
深忆病人 2020-12-12 16:44

I have a service which is binded to application context like this:

getApplicationContext().bindService(
                    new Intent(this, ServiceUI.class         


        
8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-12 16:58

    Doing exactly what Andrey Novikov proposed didn't work for me. I simply replaced:

    getApplicationContext().unbindService(serviceConnection);
    

    With:

    unbindService(serviceConnection);
    

提交回复
热议问题