When OnResume gets called ?
User is in Activity 1 and now traverses to Activity 2. (Activity 1 is not visible at all). Now User clicks back button from Activity 1, OnResume method of Activity 1 gets called.
When OnRestart gets called ?
When user traverses from Activity 1 to Activity 2 as in above case, moves back to Activity 1, onRestart gets called.
so what is the difference ?
OnResume method gets called everytime when an activity moves between background to foreground state.
But, onRestart gets called only when onStop method is called.
Please note that, the system also calls the onStart() method, which happens every time your activity becomes visible (whether being restarted or created for the first time). The onRestart() method, however, is called only when the activity resumes from the stopped state.
When to use OnRestart Method ?
Use this when you want to perform special restoration work that might be necessary only (if you have handled onStop method for releasing ay CPU intensive resources) if the activity was previously stopped, but not destroyed.