Android Question MyToastMessageShow truncting text

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I modified MyToastMessageShow to use a Mono Space font so if I want to do a multi line message I can line things up.

Public  Sub MyToastMessageShow(Text As Object, LongDuration As Boolean, Center As Boolean, BackgroundColor As Int, TextColor As Int, Alert As Boolean)
           Dim toast        As JavaObject
           Dim ctxt        As JavaObject
           Dim duration    As Int
           If  LongDuration Then
               duration = 1
               duration = 0
           End If
           Dim cs As CSBuilder
           cs.Initialize.Typeface(Typeface.CreateNew(Typeface.MONOSPACE, Typeface.STYLE_ITALIC)).Bold.Color(TextColor).Size(16).Append(Text).PopAll

           toast = toast.InitializeStatic("android.widget.Toast").RunMethod("makeText", Array(ctxt, cs, duration))
           Dim v    As View = toast.RunMethod("getView", Null)
           v.Background = MakeColorDrawable(BackgroundColor, 5dip, 2dip, TextColor)
             If  Center Then
               toast.RunMethod("setGravity", Array(Bit.Or(Gravity.CENTER_HORIZONTAL, Gravity.CENTER_VERTICAL), 0, 0))
           End If
           If  Alert Then
           End If
           toast.RunMethod("show", Null)
End Sub

A lot of my messages are getting Truncated when I call it

 cGenFuncs.MyToastMessageShow("Long Click / Press & Hold to PAY", True, True, Colors.Red, Colors.White, False)


As you can see in this Message the "Y" is being chopped - Sometimes the whole letter is missing.
That I need to add some extra spaces at the end to make sure everything shows.

Is there ANY fix for this