Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I include a button in a Toast notification?

Tags:

android

First of all, I know this has been asked before: Button in custom Android Toast?. This is nearly an exact duplicate, but I think that it warrants a new question based on the fact that it's been used in apps, namely Gmail for ICS (it appears when you delete a message).

The linked question says that it's not possible to include a button in a Toast because Toasts cannot be focused. Is this wrong, outdated, or did Gmail find a way around it?

like image 390
jmgrosen Avatar asked Mar 05 '12 23:03

jmgrosen


People also ask

How do you add a button on react toast?

You can include action Buttons into toast by adding buttons property. You can bind collections of Essential JS 2 Button Model to model property inside buttons property, You can also include click event callback function, for each button.

What is the difference between toast and notification?

A toast is a small display on the bottom of the screen. A notification is displayed in the top menu bar.

What are toast buttons?

A toast provides simple feedback about an operation in a small popup. It only fills the amount of space required for the message and the current activity remains visible and interactive. Toasts automatically disappear after a timeout.


1 Answers

The Gmail undo bar is't a toast, here is how Google did it

http://code.google.com/p/romannurik-code/source/browse/misc/undobar/src/com/example/android/undobar/UndoBarController.java

I guess this answers your question.

like image 77
Hazem Farahat Avatar answered Oct 06 '22 00:10

Hazem Farahat