Sub Activity_Click
Dim dialog As CustomLayoutDialog
Dim sf As Object = dialog.ShowAsync("", "Yes", "Cancel", "No", Null, False)
dialog.SetSize(100%x, 300dip)
'Code to change top position
Dim jo As JavaObject = sf
Dim window As JavaObject = jo.RunMethodJO("getWindow", Null)
Dim lp As JavaObject = window.RunMethod("getAttributes", Null)
lp.SetField("gravity", Bit.Or(Gravity.TOP, Gravity.CENTER_HORIZONTAL))
lp.SetField("y", 40dip) 'set the top position
window.RunMethod("setAttributes", Array(lp))
'****
Wait For (sf) Dialog_Ready (DialogPanel As Panel)
DialogPanel.LoadLayout("DialogLayout")
Dim firstName As EditText = DialogPanel.GetView(0)
Dim lastname As EditText = DialogPanel.GetView(1)
Wait For (sf) Dialog_Result (Result As Int)
firstName.Enabled = False 'disable the text fields to make the keyboard disappear
lastname.Enabled = False
If Result = DialogResponse.POSITIVE Then
Log("First name: " & firstName.Text)
Log("Last name: " & lastname.Text)
End If
End Sub