FLAG_ACTIVITY_CLEAR_TOP不工作的5.0+设备 [英] FLAG_ACTIVITY_CLEAR_TOP not working on 5.0+ devices
本文介绍了FLAG_ACTIVITY_CLEAR_TOP不工作的5.0+设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用的是FLAG_ACTIVITY_CLEAR_TOP意图标志清除栈从登录活动过渡到主要的应用程序的时候 - 一切完美的4.x的设备,但棒棒糖它不工作。我想补充一些code,这里是我打电话是什么:
I use the FLAG_ACTIVITY_CLEAR_TOP intent flag to clear the stack when transitioning from a login activity to the main app - everything works perfectly in 4.x devices, but on lollipop it's not working. Just to add some code, here's what I'm calling:
Intent intent = new Intent(this, MyActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
我在使用会同FLAG_ACTIVITY_NEW_TASK标志尝试,但也没有帮助。
I've tried using the FLAG_ACTIVITY_NEW_TASK flag in conjunction but that also hasn't helped.
推荐答案
使用此
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP);
这篇关于FLAG_ACTIVITY_CLEAR_TOP不工作的5.0+设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文