Error occurred on line: 214 (B4XDialog)
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Object.equals(java.lang.Object)' on a null object reference
at b4a.SondeTransfer.b4xdialog._getbutton(b4xdialog.java:757)
at b4a.SondeTransfer.subs._setdialog(subs.java:465)
at b4a.SondeTransfer.b4xmainpage$ResumableSub_StartSub.resume(b4xmainpage.java:1673)
at b4a.SondeTransfer.b4xmainpage._startsub(b4xmainpage.java:1628)
at b4a.SondeTransfer.b4xmainpage$ResumableSub_btnConnect_Click.resume(b4xmainpage.java:1536)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:48)
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:146)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1717)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8751)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
In B4J it works correct, it is because ButtonCancel = ""
How can i look which button is set in sub SetDialog ?
Thanks for your help
Marion
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Object.equals(java.lang.Object)' on a null object reference
at b4a.SondeTransfer.b4xdialog._getbutton(b4xdialog.java:757)
at b4a.SondeTransfer.subs._setdialog(subs.java:465)
at b4a.SondeTransfer.b4xmainpage$ResumableSub_StartSub.resume(b4xmainpage.java:1673)
at b4a.SondeTransfer.b4xmainpage._startsub(b4xmainpage.java:1628)
at b4a.SondeTransfer.b4xmainpage$ResumableSub_btnConnect_Click.resume(b4xmainpage.java:1536)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:48)
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:146)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1717)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8751)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
In B4J it works correct, it is because ButtonCancel = ""
How can i look which button is set in sub SetDialog ?
Thanks for your help
Marion
Set DialogView:
B4XPages.MainPage.msgText.Visible = True
B4XPages.MainPage.msgTitel.Text = "Bitte Speichername eingeben"
[B]MsgO = B4XPages.MainPage.msgdialog.showcustom(B4XPages.MainPage.DialogView,"OK",Language.Text(Var.v,74) , "")
Subs.SetDialog(B4XPages.MainPage.msgdialog)[/B]
wait for (MsgO) Complete (result As Int)
If result = xui.DialogResponse_Positive Then
Public Sub SetDialog(V As B4XDialog)
ground = True
v.BackgroundColor = Var.limablue
V.ButtonsHeight = 10dip
v.BorderColor = Var.lblColor
v.ButtonsOrder = Array As Int(xui.DialogResponse_Positive,xui.DialogResponse_Cancel, xui.DialogResponse_Negative)
v.BorderCornersRadius = 15dip
v.BorderWidth = 1dip
#if b4a
V.BorderWidth = 3dip
#End If
v.TitleBarFont = Var.BigFont
v.TitleBarColor = xui.Color_Transparent
v.TitleBarTextColor = Var.lblColor
Dim Abstand As Int
Dim b1,b2,b3 As B4XView
b1 = v.GetButton(xui.DialogResponse_Positive)
If b1.IsInitialized = True Then
' b1.Height = 15dip
' b1.TextSize = 12
' Abstand = ((Var.ScreenWidth * 0.4) - (3 * (b1.Width))) / 4
' b1.TextColor = Var.txtColor
' b1.Left = Abstand
' b1.Top =(Var.ScreenHeight * 0.3) - 5dip
' b1.SetColorAndBorder(Var.limadarkblue,1dip,xui.Color_White,15dip)
Abstand = ((Var.ScreenWidth) - (3 * (b1.Width))) / 4
b1.TextSize = 12
b1.Height = 35dip
b1.TextColor = Var.txtColor
b1.Left = Abstand
b1.SetColorAndBorder(Var.limadarkblue,1dip,xui.Color_White,15dip)
End If
b2 = v.GetButton(xui.DialogResponse_Negative)
If b2.IsInitialized = True Then
Abstand = ((Var.ScreenWidth) - (3 * (b2.Width))) / 4
b2.TextSize = 12
b2.Height = 35dip
b2.TextColor = Var.txtColor
b2.Left = Abstand * 2 + b2.Width
b2.SetColorAndBorder(Var.limadarkblue,1dip,xui.Color_White,15dip)
End If
' #if b4j
If V.GetButton(xui.DialogResponse_Cancel) < 0 Then
Log ("OUT")
End If
[B] b3 = V.GetButton(xui.DialogResponse_Cancel) -->ERROR LINE[/B]
If b3.IsInitialized = True Then
b3.textsize = 12
b3.height = 35dip
Abstand = ((Var.ScreenWidth) - (3 * (b3.Width))) / 4
b3.TextColor = Var.txtColor
b3.Left = Abstand * 3 + (b3.Width) * 2
' b3.Top = (Var.ScreenHeight * 0.3) - 5dip
b3.SetColorAndBorder(Var.limadarkblue,1dip,xui.Color_White,15dip)
End If
' #End If