Faisal khan Faisal khan - 4 months ago 34
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


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.