我想在oncreate()
Main
android:noHistory="true"
方法中启动MainAcitivty后清除HistoryStack。
由于某些问题,我无法使用finish()
,因为它会导致我的gPlus登录出现问题,但出于类似原因也无法使用FLAG_ACTIVITY_NO_HISTORY
SELECT dbo_job.item, sub2.item AS NewCheck
FROM dbo_job
LEFT JOIN (
SELECT dbo_job.item
FROM dbo_job
WHERE dbo_job.job_date<=#7/13/2015# AND dbo_job.job_date>=#6/22/2015#
GROUP BY dbo_job.item)
AS sub ON sub.item=dbo_job.item
LEFT JOIN (
SELECT dbo_job.item
FROM dbo_job
WHERE dbo_job.job_date<#7/13/2015#
GROUP BY dbo_job.item)
AS sub2 ON sub2.item=dbo_job.item
WHERE dbo_job.job_date=#7/20/2015# AND sub.item IS NULL
GROUP BY dbo_job.item, sub2.item
。
我只希望在特殊情况下删除它,当它在Main内部时,否则它应该在History堆栈中。
一旦进入Main,所有历史记录堆栈都应该清除,并且在按下后应用程序应该退出。是否有可能,如果是,请解释。
答案 0 :(得分:1)
对于没有最近活动,活动在欲望活动中使用android:excludeFromRecents="true"
。
答案 1 :(得分:1)
您可以在要完成的所有活动中添加BroadcastReceiver。
public class MyActivity extends Activity {
private FinishReceiver finishReceiver;
private static final String ACTION_FINISH =
"com.mypackage.MyActivity.ACTION_FINISH";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
finishReceiver = new FinishReceiver();
registerReceiver(finishReceiver, new IntentFilter(ACTION_FINISH));
}
@Override
protected void onDestroy() {
super.onDestroy();
unregisterReceiver(finishReceiver);
}
private final class FinishReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(ACTION_FINISH))
finish();
}
}
}
您可以通过调用
关闭这些活动sendBroadcast(new Intent(ACTION_FINISH));
查看此示例以获取详细信息: