When the action begins, onCreate() is called first, and then onResume() is onResume() , if you want it to be called only once, delete the call in onCreate() .
calling the method in onResume () ensures that the method is called when activity regains focus, for example, after a backpressure, etc.
source share