Android Question Showcustomtoast java.lang.RuntimeException

gregorio_adrian_gimenez

Active Member
Licensed User
Longtime User
Hi all,
This error is generated, in the model samsung s21 Android 11 SDK30, it does not happen on other phones, can someone guide me?



Code:

B4X:
Sub rewad_Rewarded (Item As Object)  
    Dim cs As CSBuilder
     
    cs.Initialize.Alignment("ALIGN_CENTER").RelativeSize(30dip).Typeface(Typeface.SANS_SERIF).bold.Color(Colors.White).Size(18).Append(Starter.loc.Localize("Has sido recompensado, podrás enviar hasta ")).Pop.Pop
   
    cs.bold.Color(Colors.Red).Size(25).Append(contador_publicidad).Pop.Pop.Pop
    cs.Color(Colors.White).Size(18).Append( Starter.loc.Localize(" traducciones , recuerda que siempre tienes la opción de  ")).Pop
    cs.Color(Colors.White).Size(20).Append(Starter.loc.Localize("suscribirte")).Pop
    cs.Color(Colors.White).Size(18).Append( "  a  ").Append(CRLF). Pop
   
    cs.bold.Color(Colors.White).Size(27).Append("app").popall
   
    ShowCustomToast(cs, True, Colors.RGB(25,208,35))
   
   
End Sub



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)
   Dim cd As ColorDrawable
   cd.Initialize(BackgroundColor, 20dip)
   v.Background = cd
   toast.RunMethod("show", Null)
End Sub

regards
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…