I have a activty A and after a button click I am starting another activity B in which I am starting a service using bindService
as below:
Intent intent = new Intent(context, RadioService.class); context.bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE);
During this the onCreate()
of the service class is being called. Now when I close the activity B inside onDestroy()
of BI am stopping the service as below:
context.unbindService(serviceConnection);
The problem that I am facing is second time if I enter the activity B the service class onCreate()
is not being called. Why is so that the case? What can be done as I want the onCreate()
to be called.
我通过在bindService()
之前调用startService()
来解决它。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.