The code below works fine in B4j but is failing in B4A. The error, as you can see below is in B4XDialog. I tried rearranging the order in which I get the three buttons but it doesn't matter. It ALWAYS works fine getting the FIRST button and fails on the second one. Am I missing something obvious again?
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
Thanks for any help.
			
			
			
				B4X:
			
		
		
		Sub InputDlg(Title As String, TitleTextSize As Int, DefText As String) As ResumableSub
    Dim input As B4XInputTemplate
    input.Initialize
    input.TextField1.TextColor = xui.Color_Black
    input.Text = DefText
    input.TextField1.EditTextHint = "Names are case sensitive"
    input.lblTitle.TextColor = xui.Color_Black
    If TitleTextSize > 0 Then input.lblTitle.TextSize = TitleTextSize
    input.SetBorderColor(xui.Color_Black, xui.Color_Red)
    Dim Pnl As B4XView = xui.CreatePanel("")
    Pnl.Color = xui.Color_White
    input.TextField1.Parent.AddView(Pnl, input.TextField1.Left, input.TextField1.Top, input.TextField1.Width, input.TextField1.Height)
    Pnl.SendToBack
'    input.TextField1.SetColorAndBorder(XUI.Color_ARGB(255, 0, 0,0), 1dip, XUI.Color_Black, 0)
    Dialog.BlurBackground = False
    Dialog.BackgroundColor = 0xFFF1F1F1
    Dialog.ButtonsColor = 0xFFB3B3B3  'you CAN set colors directly from the color picker
    Dialog.ButtonsTextColor = xui.Color_Black
    Dialog.OverlayColor = xui.Color_ARGB(95, 0, 0, 0)  'this sets the overall background
    Dialog.ButtonsOrder = Array As Int(xui.DialogResponse_Negative, xui.DialogResponse_Cancel, xui.DialogResponse_Positive)
    input.lblTitle.Text = Title
    Dim Dlg As Object = Dialog.ShowTemplate(input, "OK", "", "CANCEL")
'    BorderForBtns(Dialog.GetButton(xui.DialogResponse_Cancel))
'    BorderForBtns(Dialog.GetButton(xui.DialogResponse_Positive))
'    BorderForBtns(Dialog.GetButton(xui.DialogResponse_Negative))
    Dim X As Int, Btn As B4XView
    For x = -3 To -1
        Btn = Dialog.GetButton(X)
'        put a border around the buttons
        If Btn.IsInitialized Then
            Dim Pnl As B4XView = xui.CreatePanel("")
            Pnl.SetColorAndBorder(xui.Color_Black, 2dip, xui.Color_Black, 5dip)
            Btn.Parent.AddView(Pnl, Btn.Left - 2dip, Btn.Top - 2dip, Btn.Width + 2dip, Btn.Height + 2dip)
            Pnl.SendToBack
'            Btn.RequestFocus  'doesn't work Set the focus to the button so the hint text is visible
        End If
    Next
    Wait For (Dlg) Complete (Result As Int)
    If Result = xui.DialogResponse_Positive Then
        Return input.Text
    End If
    Return ""
End Sub
			
				Error::
			
		
		
		** Activity (main) Resume **
Error occurred on line: 217 (B4XDialog)
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Object.equals(java.lang.Object)' on a null object reference
    at com.SuperlativeSoftware.LearALanguage.b4xdialog._getbutton(b4xdialog.java:216)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
    at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
    at com.SuperlativeSoftware.LearALanguage.recordpg._inputdlg(recordpg.java:492)
    at com.SuperlativeSoftware.LearALanguage.recordpg$ResumableSub_QuickSaveBtn_Click.resume(recordpg.java:992)
    at com.SuperlativeSoftware.LearALanguage.recordpg._quicksavebtn_click(recordpg.java:775)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
    at android.view.View.performClick(View.java:7729)
    at android.view.View.performClickInternal(View.java:7706)
    at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
    at android.view.View$PerformClick.run(View.java:30484)
    at android.os.Handler.handleCallback(Handler.java:959)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loopOnce(Looper.java:232)
    at android.os.Looper.loop(Looper.java:317)
    at android.app.ActivityThread.main(ActivityThread.java:8501)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)Thanks for any help.
 
				 
 
		 
 
		 
 
		 
 
		 
 
		