B4A Library Customtoast library

Hey,

I was just a bit bored and decided to make a small library for fun.
It's nothing special. With this library, you are able to position your toastmessage and choose the duration.

The duration is approximately and not correct.

Code:
Dim ct1 As CustomToast
ct1.Initialize
ct1.Show("This is a custom toast message.",10000,Gravity.TOP,0,0)

It also works when the activity is closed.

Cheers,

Tomas
 

Attachments

Last edited:
I think that toastmessage doesn't have "OK" button or any button.

Did you mix it with MsgBox ???

I got this application in Google Play and installed it to see how it works. It seems to me that their toast message does really have an OK button. Or at least it is a custom message dialog that can behave very similarly to a real toast message, which can display out of its "parent" application and on top of all other applications as well...

The application name is "caller's last sms"

https://play.google.com/store/apps/...xLDEsImNvbS5yYWplc2guY2FsbGVyLmxhc3RzbXMiXQ..
 

Attachments

  • unnamed[5].jpg
    unnamed[5].jpg
    17.7 KB · Views: 623
Last edited:
Thanks guys!

Customtoast library has been updated.
Now you are able to add an image to the toast message shown on the post above. However it's not possible to add the Attention(see the right image) as you'd need your own custom xml files.

This will make a toast message covering the whole screen for approx. 10 seconds, showing a logo at the top and text beneath it.

XverhelstX

Hi XverhelstX

Can we have a click event for your toast message? (as it has no button, I want the user at least to have something to interact with it)

Thanks

Best
 
As far as i know, it is impossible to add a button to a toastmessage.
You should create your own custom toast message.

I think there a class available for that.

Regards,
Tomas

Verstuurd van mijn R800i met Tapatalk

No, I don't mean to add a button to the toast and we have click event for that button.

What I meant is a click event on the toast itself, when we click directly on the toast message, for example. I want the user can have possibility to close the toast, for example, or we can run some codes...

Can we do that ?

I think there a class available for that.

Are you sure? Do you mean for B4A? Those toast messages will be within its main application only (they are "in-app" toast message). Sorry if I am wrong.

Thanks
 
Last edited:
nice!!

sorry ... i know i'm the millionth that asks for adding ... :sign0089:
i think that your library should need of "DISAPPEAR" command vs "SHOW".
this should be use during a loop
if i use 10000 as ms and the loop ends before, i'd be able to turn off the message.
i tried to overlap it but i find no way to delete it ...
many thanks

peppe
 
Good job!

I like your library very much.
:)
It's possible to make the toast message background transparent?
it would be nice too if you can have a null or blank message, in order to show only the image.
 
Lovely Work !

Hi

Is there any chance you can include a method to hide or destroy the message. Also if the duration was Zero or -1 this could be used to show the message until you issue the hid or destroy command.

Cheers

John.:sign0089:
 
Great, got it plugged in. Now do images need to have a transparent background to display nicely?
 
I just want to change the color of the toast and text, and the font itself. How would I do that?

Maybe even the corner radius if possible.
 
Hello XverhelstX. I have created an app that I am going to put in Google Play that makes use of your library. I would like to know what I need to do to give you proper credit for your work before I publish it ( I already have a credits page)
 
This was really helpful for me - wanted a toast message to show for a while, and from a Service. Can confirm it works a treat.

Thanks.
 
Hi XverhelstX, great work thank you very much.
I have tested the lib in a app and have seen that the toast always appears two times.
I call the toast as shown in the forum:
ct1.ShowBitmap("hallo1234",10000,Gravity.FILL,0,0,bmp)
do I miss something?

THX
 
OK my misstake, but maybe a good experience! The duration was long and i showed other standard toast messages while the customtoast was showing.
The result was that the customtoast came back when the others had finished.
 
Back
Top