结算活动堆栈堆栈

2023-09-12 05:20:10 作者:跳河--自杀。

我无法清除我的应用程序的活动栈。在我的应用程序开始我让用户登录,并给他们一个会话ID。他们登录后,他们能够继续使用的应用程序。然而,如果有会话到期我想将它们重​​定向到登录活动并清除活动历史所以它们不能访问该应用。我看了看在Android API和意图的标志 FLAG_ACTIVITY_CLEAR_TASK 似乎是想,但我想这只是包含在API级别11,没有手机有新的操作系统呢。有没有人有办法解决这个问题。谢谢你。

I am having trouble clearing my app's activity stack. At the start of my app I make the user login and give them a session id. After they login they are able to continue on using the app. However if there session expires I want to redirect them to the login activity and clear the Activity history so they can't have access to the app. I looked at the Android API and the Intent flag FLAG_ACTIVITY_CLEAR_TASK seems to be want I want but it was just included in API level 11 and no phones have the new OS yet. Does anyone have a solution to this problem. Thanks.

推荐答案

我发现我的答案here.事实证明,我有广播的意图告诉所有的活动中来调用方法完成()

I found my answer here. Turns out that I have to broadcast an intent to tell all of the Activities to call the method finish().