开发者

Android Home button click ignoring saved state?

Can I ignore the previous stage of application after tapping Home b开发者_如何学Cutton in android? So that I can get the application from initial screen.


Use like this.If now you are in LastActivity and you want to go back to the First Activity and there is more activity in between then if you want to go first from last use

@Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if(autoSearch)
        if (keyCode == KeyEvent.KEYCODE_HOME) {
           Log.d("click","HOMEButtonclicked");
          LastActivity.this.startActivity(new Intent(LastActivity.this, FirstActivity.class));
           moveTaskToBack(false);
           return true;
        }
        return super.onKeyDown(keyCode, event);
    }
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜