Faisal khan Faisal khan - 1 year ago 204
Android Question

Android Activity as a dialog

I have an Activity named

which has child dialogs as well. Now, I want to display this activity as a dialog for another activity.

How can I do that?

enter image description here

Answer Source

To start activity as dialog I defined it like this in AndroidManifest.xml:

<activity android:theme="@android:style/Theme.Dialog" />

Now when I call startActivity() it displays as a dialog, with the previous activity shown when the user presses the back button.

Note that if you are using ActionBarActivity (or AppCompat theme), you'll need to use @style/Theme.AppCompat.Dialog instead.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download