I want to start an activity as a dialog, which can be simply done by:
<activity android:theme="@android:style/Theme.Dialog">
But I want to do control the dialog, so I’ve to do it programmatically. Basically I want to modify this property of dialog:
mCanceledOnTouchOutside = true
This will make the dialog cancel itself when touched outside of it’s bounds. (Basically I want to replicate the popup behavior). The issue is I can’t simply create a dialog and set it’s layout since I need a call to activity (to initialized datasets)
Is this possible ?
This doesn’t really make since, because an activity is not a dialog. By setting the theme, all you are doing is causing the activity to visually use the theme of a dialog. It is still an activity, however, will all of the normal activity behavior. In other words, there is no Dialog object with its associated behavior.