开发者

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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜