app运行时,按下home键回到桌面,
再次点击进入会重启app,而不是停在按下home前的页面。
调试模式: 正常
建议在BaseActivity添加如下判断,并且在setContentView前调用
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//此判断解决 按下home键,重启app问题
if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) {
// Activity was brought to front and not created,
// Thus finishing this will get us to the last viewed activity
finish();
return;
}
}