After upgrading to B4A 10.9 and switching to SDK 30
My Custom Toast Message (CTM) has started failing
The toast.RunMethod("getView", Null) is returning v as NOT IsInitialized
Any ideas how to fix this?
My Custom Toast Message (CTM) has started failing
The toast.RunMethod("getView", Null) is returning v as NOT IsInitialized
B4X:
Sub ShowCustomToast(Text As Object, LongDuration As Boolean, BackgroundColor As Int)
Dim ctxt As JavaObject
ctxt.InitializeContext
Dim duration As Int
If LongDuration Then duration = 1 Else duration = 0
Dim toast As JavaObject
toast = toast.InitializeStatic("android.widget.Toast").RunMethod("makeText", Array(ctxt, Text, duration))
Dim v As View = toast.RunMethod("getView", Null)
#if Debug
If v.IsInitialized = False Then
Log("v NOT Initialized")
End If
#End If
Dim cd As ColorDrawable
cd.Initialize(BackgroundColor, 20dip)
v.Background = cd
'uncomment to show toast in the center:
' toast.RunMethod("setGravity", Array( _
' Bit.Or(Gravity.CENTER_HORIZONTAL, Gravity.CENTER_VERTICAL), 0, 0))
toast.RunMethod("show", Null)
End Sub
Any ideas how to fix this?