8

I at some date and time when application not active show dialog (activity with Dialog theme; otherwise there is not possibility to do).

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

Intent.FLAG_ACTIVITY_NEW_TASK => so when I start application after dialog showing through Home button(recent apps) DialogActivity is opening instead of Application.

How can I make to open my application?

Armand
  • 23,463
  • 20
  • 90
  • 119
drifter
  • 683
  • 1
  • 11
  • 24
  • Does it happen, when you resume the app (from Recent apps) after you have quit your app by pressing back button? – B.B. Dec 29 '16 at 13:28

1 Answers1

-3

a silly idea since i don't know what exactly is your purpose, but will work fine

in DialogActivity.class,

override method onResume() something like,

@Override
protected void onResume() {
    DialogActivity.this.finish();
    super.onResume();
}
ngesh
  • 13,398
  • 4
  • 44
  • 60
  • 1
    Then dialog will not be shown never. Even if - I think that application will not be shown then instead of dialog. ------------------------------------ a silly idea since i don't know what exactly is your purpose, but will work fine 1) There is AlarmManager. 01.01.2012 for example the activitydialog is showing through Intent.FLAG_ACTIVITY_NEW_TASK (othewise there is not because app in background). But after dialog was shown I start app through Home Button(click on App screenshot) instead of my app dialog is starting.(If after dialog was shown I start app normally(click on icon) - All is OK) – drifter Sep 08 '11 at 14:03
  • http://stackoverflow.com/questions/2147144/android-how-to-display-a-dialog-over-a-native-screen – drifter Sep 08 '11 at 14:06
  • Maybe it will be useful for someone: excludeFromRecents="true" - it works for me – drifter Sep 08 '11 at 14:48
  • @drifter doesn't work for me.Could you please give post the activity element in manifest of your dialog activity – hemanth kumar Jan 31 '14 at 13:23