I currently have a tabview and in my first tab i have a toast message that appears. If click on another tab while the toast is still displaying, it will display in that tab as well. Is there any way to not make this happen? Do i simply cancel it inside the onPause()
? thanks for your help
Asked
Active
Viewed 425 times
0

Splitusa
- 1,181
- 7
- 31
- 51
3 Answers
0
Toast's are not tied with any particular activity as they are an overlay over the screen. If you want to explicitly close the Toast, you need to pass a handle of it to whichever activity needs to close it and call Toast.cancel()
.

Jason Robinson
- 31,005
- 19
- 77
- 131
0
You could detect tab change and cancel it in that method. For tab change help - Android TabWidget detect click on current tab
0
Yeah you can simply call cancel()
in onPause()
of the activity that has created it.

wasaig
- 666
- 5
- 18