Intent.FLAG_ACTIVITY_NEW_TASK

dri*_*ter 8 android

我在某个日期和时间应用程序未激活显示对话框(具有Dialog主题的活动;否则没有可能做).

if (!Utils.isApplicationInForeground(context)) {
    Intent i = new Intent(context, DialogActivity.class);
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(i);
}
Run Code Online (Sandbox Code Playgroud)

Intent.FLAG_ACTIVITY_NEW_TASK=>所以当我通过主页按钮(最近的应用程序)显示的对话框DialogActivity打开而不是应用程序时启动应用程序.

如何打开我的申请?

nge*_*esh -3

这是一个愚蠢的想法,因为我不知道你的目的到底是什么,但效果很好

DialogActivity.class中,

覆盖方法onResume()类似,

@Override
protected void onResume() {
    DialogActivity.this.finish();
    super.onResume();
}
Run Code Online (Sandbox Code Playgroud)