ITeye博客

判断从home键长按进入

yulincqupt · 2012-12-28 21:33 · 判断从home键长按进入 · 移动开发 · Markdown

int flag = mIntent.getFlags();
        if((flag & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY ) != 0) {
           startActivity(new Intent(this,SplashActivity.class));
           finish();
        }

 

PS:

  • HOME键的执行顺序:onPause->onStop->onRestart->onStart->onResume
  • BACK键的顺序:  onPause->onStop->onDestroy->onCreate->onStart->onResume
  • onPause不要做太耗时的工作

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。