I have a service S which gets started as soon as the boot is completed. I have an application with one Activity which binds to the service S when the app is launched.
Now I have registered a broadcast receiver for certain event so that if the event occurs I should launch the same Activity. I don’t want another instance of the same Activity to be created, I want to reuse the Activity but onCreate() or onRestart() method of the Activity should be called.
How can I achieve this?
I’m not 100% positive of your question, but here we go. You could try using a static method in your mainactivity and call it from your service.
In your main activity:
then in your Service: