It’s possible to show an Activity as a Dialog. All we need to do is use a Dialog theme for the android:theme attribute in the AndroidManifest.xml file. You can use any Dialog theme.
<activity android:name="com.example.demoapp.MainActivity" android:label="@string/title_dialog_activity" android:theme="@android:style/Theme.Holo.Light.Dialog" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
But the dialog will cancel if you touch outside. To prevent this use setFinishOnTouchOutside(false)
in the onCreate method of the activity.