Sub ShowDialog
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0, 0, 0, 300dip, 170dip) 'set the content size
p.LoadLayout("CustomLayout")
Dim rs As ResumableSub = Dialog.Show(Activity, p, "Ok", "", "Cancel")
Wait For (rs) Complete (Result As Int)
If Result = xui.DialogResponse_Positive Then
'do something
End If
End Sub