+ 4
How to make a toast, after clicking on button?
First hide toast, after clicking on button it will be show for 3 seconds, and it will be automatically hide after 3 seconds. https://code.sololearn.com/W1gr6yZtM4Qj/?ref=app
6 Respostas
+ 5
https://code.sololearn.com/W224hE9ARaf4/?ref=app
+ 3
Calviղ Pls avoid giving finished code as answer, because it makes the OP skip the most important part of learning. Prefer giving hints for the OP to find the solution instead.
+ 1
note the <script> tags in aYeShA 's code. You need to use JavaScript (or php if you're a time traveler from 20 years ago) for this level of interactive content.
+ 1
SWARUP MAHATO
I assume you are trolling.
Are you ok? You just posted a bunch of nonsense posts... maybe take a break from coding for a while.
Anyway, it's html, javascript not xml, java and android.
And there's no Runnable in your code that runs a timer and hides the Toast.
0
aYeShA
you could Google for the dialog element.
Popups using this tag have .show() and .close() methods so you don't need to use the display:block or display:none workaround.
But as in Calviղ 's code example, you still need a setTimeout to close it after the desired time period.
I made a small codebit on how dialog might be used. I also included Calviղ 's fancy slidedown code.
Explaining it is harder sometimes, so we provide examples. If there is anything you don't understand, ask and I am sure members here will be happy to explain it to you.
https://code.sololearn.com/WWa5b6Xe29GA/?ref=app