Android Question Toast message not closing

Mostez

Well-Known Member
Licensed User
Longtime User
I display a toast message (BCToast) from Activity 1 before calling StartActivity 2, when I go back to Activity 1, the toast message still exist and it does not close. is it possible to use wait for, or any other method to handle this?

Thanks
 

JohnC

Expert
Licensed User
Longtime User
Please post the code where you display the toast and the name of the sub that the code is in.

I have a feeling there is a bug that is causing the toast line of code to be run over and over again and it's giving the illusion its staying on.

You can test this by adding the below line after your toast line:
B4X:
ToastMessageShow("Some message that won't go away",False)   '<--- this is your current line where you display the toast
Log("Ran Toast message")
Now, when the problem happens (when the toast wont close), look at the log events on the right side of the IDE and see if you now see repeating lines of "Ran Toast Message". If so, then something is causing that toast line to be run over and over - maybe a repeating event?
 
Last edited:
Upvote 0

Mostez

Well-Known Member
Licensed User
Longtime User
no John, when toast message displayed, and I did not click the button to start activity 2, after duration it close OK. But if I click the button to start activity 2 before it closes, it will be on forever.

B4X:
Sub Globals   
    Private Toast As BCToast

B4X:
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("main")
    Toast.Initialize(Activity)
    Toast.DurationMs = 1000

.....
.......
If Myuser.CanLog Then
                Toast.Show("e-trip Mobile, access granted")
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…