我正在尝试在我的应用程序中创建“注销”功能。基本上,通过注销,应用程序数据应该被清除。我想做的是注销后,应用程序应该重新启动,以便可以再次输入凭据等。我遇到的问题是,在用户单击“注销”时,应用程序已经有 3-4 个活动正在运行,并且我不知道如何退回这些活动。我如何(模拟?)应用程序重新启动?
检查意图属性,如无历史记录、清除后退堆栈等... Intent.setFlags
Intent mStartActivity = new Intent(HomeActivity.this, SplashScreen.class);
int mPendingIntentId = 123456;
PendingIntent mPendingIntent = PendingIntent.getActivity(HomeActivity.this, mPendingIntentId, mStartActivity,
PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager mgr = (AlarmManager) HomeActivity.this.getSystemService(Context.ALARM_SERVICE);
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 100, mPendingIntent);
System.exit(0);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)