hide Toast

左心房为你撑大大i 提交于 2019-12-10 13:08:31

问题


I am developing an application that uses system activity to add a contact to phone's memory. This external activity launches a Toast after saving the contact. Is there any possibility to get rid of it? It would be perfect if I could get a reference to it to call cancel() or cancel all queued Toasts. Is there any Toast manager?


回答1:


No. You could cancel the Toast if you had a reference to it but since it is created by a separate activity you can't access it.




回答2:


If you create a Toast message as explained in the documentations:

Toast toast = Toast.makeText(context, text, duration);

Now you can cancel the toast with toast.cancel see the documentation of the Toast class



来源:https://stackoverflow.com/questions/3186290/hide-toast

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!