我正在尝试在我的应用程序中创建一个“注销”功能。基本上,通过注销,应用程序数据应该被清除。我想做的是在注销后,应用程序应该重新启动,以便可以再次输入凭据等。我遇到的问题是,在用户单击“注销”时,应用程序已经有3-4个活动在运行,而我不确定如何返回到这些活动。如何(模拟?)重启应用程序?
发布于 2013-03-22 15:16:50
签出意图属性,如无历史记录、清除后台堆栈等。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);https://stackoverflow.com/questions/15564614
复制相似问题