Android manifest file: always start application from the beaning when user resuming the application after pressing the home button
My application con开发者_C百科tain some default intent and user defined ,i want my application to start always from the beaning when user resuming the application after pressing the home button
Whenever the 'Home' button is pressed, the application is paused. and onPause() is called.
Whenever it is resumes, onResume() method is called.
override the onResume() method, as you override onCreate(), and do all the things necessary to be done when application resumes, inside the onResume() method.
Sudeep , Supporting Sheikh Alam I would like to add below code to your activity to track whether your activity is focussed
@Override
public void onWindowFocusChanged (boolean hasFocus)
{
super.onWindowFocusChanged (hasFocus);
if(hasFocus){
//your code here when app has focus
}
}
Hope it helps!Good Luck!
精彩评论