Show dialog in B4XPages.MainPage
Error displaying the dialog on line 31
Log in debug mode
Error displaying the dialog on line 31
B4X:
Sub CrearToast(titulo As String, texto As String)
If csToast.ToString = "" Then'actualizar BD
csToast.Initialize.Size(15).Color(Txts.ColorTexto).Append(texto).PopAll
End If
Dim lbl As Label
lbl.Initialize("")
lbl.TextColor = Txts.ColorTexto
lbl.TextSize = 15
lbl.Typeface = Typeface.CreateNew(Typeface.DEFAULT,Typeface.STYLE_BOLD)
lbl.Gravity = Gravity.CENTER_VERTICAL
lbl.Text = csToast
Dim xui As XUI
Dim PanelDialogo As B4XView
PanelDialogo = xui.CreatePanel("")
PanelDialogo.SetLayoutAnimated(0, -1, -1, ((lv.Width*84)/100), 27%y)
PanelDialogo.AddView(lbl,10dip,-1,-1,-1)
cs.Initialize.Alignment("ALIGN_CENTER").VerticalAlign(6dip).Color(Txts.ColorTexto).Append(titulo).PopAll
dialog.Initialize(B4XPages.GetPage("mainpage"))<------ NO ERROR
dialog.Title = cs
dialog.BorderWidth = 3dip
dialog.BorderColor = Txts.ColorTexto'blanco
dialog.BackgroundColor = Txts.ColorClaro'Colors.DarkGray' .White' .Transparent
dialog.BlurBackground = True
dialog.BorderCornersRadius = 10dip
dialog.PutAtTop = True 'mostrar dialogo
dialog.ShowCustom(PanelDialogo, "", "", "")'<------ ERROR java.lang.ClassCastException: com.modes.radio.b4xmainpage cannot be cast to android.view.View
' dialog.Show(csToast,"","","")
dialog.Base.Top = 33%y
dialog.Base.Height = 33%y
dialog.Base.Width = 85%x
dialog.Base.Left = (lv.Width-dialog.Base.Width)/2
dialog.TitleBar.GetView(0).TextSize= 18
dialog.TitleBar.GetView(0).SetTextAlignment("CENTER","CENTER")
dialog.TitleBar.SetColorAndBorder(Txts.ColorClaro,2dip,Txts.ColorOscuro,10dip)
dialog.TitleBar.Height = 40dip
dialog.TitleBar.Width = dialog.Base.Width -10dip
dialog.TitleBar.Left = 5dip
dialog.TitleBar.Top = 5dip
Dim img As ImageView
img.Initialize("")
img.Bitmap = BMPInfo
img.Gravity = Gravity.FILL
Dim ancho As Int = dialog.TitleBar.Height-6dip
dialog.TitleBar.AddView(img,5dip,3dip,ancho,ancho)'añadir icono en toolbar
End Sub
Log in debug mode
B4X:
Error occurred on line: 95 (B4XDialog)
java.lang.ClassCastException: com.modes.radio.b4xmainpage cannot be cast to android.view.View
at anywheresoftware.b4a.objects.B4XViewWrapper.getViewObject(B4XViewWrapper.java:101)
at anywheresoftware.b4a.objects.B4XViewWrapper.asPanelWrapper(B4XViewWrapper.java:104)
at anywheresoftware.b4a.objects.B4XViewWrapper.GetAllViewsRecursive(B4XViewWrapper.java:304)
at com.modes.radio.b4xdialog$ResumableSub_ShowCustom.resume(b4xdialog.java:198)
at com.modes.radio.b4xdialog._showcustom(b4xdialog.java:133)
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:144)
at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
at com.modes.radio.b4xmainpage._creartoast(b4xmainpage.java:2642)
at com.modes.radio.b4xmainpage._comprobarfechasbd(b4xmainpage.java:2629)
at com.modes.radio.b4xmainpage._ficherofirebase_metadatacompleted(b4xmainpage.java:3431)
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:144)
at anywheresoftware.b4a.BA$2.run(BA.java:387)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)