Reputation: 93
I want to show a toast - simple. The issue is I can't incorporate an OnClickListener for it. When I click on the toast I want to trigger an event.
Is it possible to use an OnClickListener with a toast?
Upvotes: 2
Views: 3554
Reputation: 5075
No you can't. But to achieve same like functionality, you may use Crouton library instead of Toasts.
https://github.com/keyboardsurfer/Crouton
Upvotes: 4
Reputation: 786
No! certainly Not! A toast provides simple feedback about an operation in a small popup. If you want to get Click event consider using Dialog for it
Upvotes: 2
Reputation: 10025
Toast also has getView() and setView() methods which enable you to set the custom view and still keep the Toast functionality. You can set onClick listenet to your custom view
Upvotes: 1
Reputation: 6736
No you cant add listener to a Toast
but you can create a custom view use it like Toast
and implement onClickListener
on it.
Upvotes: 1