Due this change in the new versions of the Android, I need to change the custom toast message.
I created the code below - based in ShowCustomToast with BCToast - that I can call of any activity (I have several apps made only for Android, with several activities and, at the moment, is not a option to migrate to B4XPages, that I use only in new projects), but I get this issue:
- If I show the BCToast in a panel and the user close the panel, before the toast disapears, if I open the panel, the toast still there.
How can I hide/release the toast, if it don't disapears automatically?
Thanks in advance for any tip.
I created the code below - based in ShowCustomToast with BCToast - that I can call of any activity (I have several apps made only for Android, with several activities and, at the moment, is not a option to migrate to B4XPages, that I use only in new projects), but I get this issue:
- If I show the BCToast in a panel and the user close the panel, before the toast disapears, if I open the panel, the toast still there.
How can I hide/release the toast, if it don't disapears automatically?
Thanks in advance for any tip.
B4X:
Sub ShowCustomToast(act As Activity, txt As Object, LongDuration As Boolean, BackgroundColor As Int, TxtColor As Int)
Private toast As BCToast
toast.Initialize(act)
Dim duration As Int
If LongDuration Then duration = 4000 Else duration = 2000
toast.DurationMs = duration
toast.DefaultTextColor = TxtColor
toast.pnl.Color = BackgroundColor
toast.Show($"[TextSize=15][Alignment=Center]${txt}[/Alignment][/TextSize]"$)
End Sub