Hide Toastmessage?

JonPM

Well-Known Member
Licensed User
Longtime User
This sounds weird, but is there a way to hide a toastmessage? For example, I have a screen that when opened will display a toastmessage with long duration. However, if the user backs out of the screen or clicks to another screen, I would like to immediately hide that toastmessage. Basically something like ProgressDialogHide but for ToastMessages.
I saw in the CustomToast library that it allows you to set custom duration, but this won't really work for me.
 

bsnqt

Active Member
Licensed User
Longtime User
@Erel:

Thanks a lot let me try it...
I always appreciate your guideline.

Best regards,

bsnqt
 
Upvote 0

bsnqt

Active Member
Licensed User
Longtime User
Hi Erel,

Now it gives me java.lang.NoSuchMethodException...

But in the Documentations, they do mention such method does exist

public void setDuration(int duration)

Set how long to show the view for.

I attached the project here for your reference.
 

Attachments

  • ToastTest(1).zip
    7 KB · Views: 257
Last edited:
Upvote 0

bsnqt

Active Member
Licensed User
Longtime User
Why do you need to call this method? You can set the duration in the Initialize method.

Erel, I know but it seems that it does not work with duration as Int in the initialize method. I have tried that already. Please see attached. It is still 3' (long) and 2' (short) :sign0104:
 

Attachments

  • ToastTest(2).zip
    7 KB · Views: 256
Upvote 0

bsnqt

Active Member
Licensed User
Longtime User
I have written a ToastMessage Class that allows you to close the Toast at will. It's at:

http://www.b4x.com/forum/additional-libraries-classes-official-updates/18926-class-custom-toast-messages.html

@margret:

Your ToastMessage Class is perfect and I am using it in my projects. Thank you very much for having shared that. I appreciate.

The only issue with me is I am in need with a more "natural" toast message which can display even out from its main app. It means it can display even on the screen even during the phone call. Let say I want to write an app where I can post some information to the user during the call, the toast has to work in this condition.

Your ToastMessage is perfectly customized but it can make the show only in its app, when the call screen is coming the main app goes to background and so the toast will disappear.

I have written a post to you in that thread but you did not read :
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…