Android – How to display a dialog over a native screen?

For my application I used an activity with the Dialog theme.
You can declare the theme in the manifest file :

<activity android:name="PopupActivity"
  android:launchMode="singleInstance" android:excludeFromRecents="true"
  android:taskAffinity="" android:theme="@android:style/Theme.Dialog" />
  • use launcheMode="singleInstance" and taskAffinity="" if your popup is detached from your main application. Otherwise user may click the back button and return to the previous activity of your application.
  • excludeFromRecents="true" to avoid your popup to appear in recent tasks (long press home)
  • theme="@android:style/Theme.Dialog" to set the Dialog theme.

Leave a Comment

tech