How to call a method every time activity is viewed?

How to call a method every time activity is viewed?

As an example, I am moving from activity1 to activity2 . Now again go to activity1 . Every time activity1 displayed / moved to this action, I need to run the loadEveryTime() method. How can i do this? Please, help!

+4
source share
1 answer

onResume() is called every time the action resumes, so put a method call there. Do not forget to call the superclass.

 @Override protected void onResume() { super.onResume(); loadEveryTime(); } 
+10
source

All Articles