I have a method that runs when the app is opened. It is called from onCreate. But I also call it from onResume. The problem I have is that at the moment it is running twice when the app opens. Is there a way to stop this or a better way to implement what I am trying to achieve?
Thanks
When an activity starts,
onCreate()is called first and thenonResume()is called,if you want it to be called only once, remove the call inonCreate().calling the method in onResume() will ensure that the method is called when the activity regains focus, like after back press etc..