我有按钮点击时运行的Toast消息。我有另一个按钮,开始另一个活动。 如果用户正在进行该活动,则toast为Ok,但如果用户在Toast完成之前导航到新活动,则显示它并不合适。如何在活动结束后立即结束祝酒。
答案 0 :(得分:1)
我没试过这个......希望它会起作用..
toast.cancel();
修改强>
Toast t = new Toast(mContext);
t=Toast.makeText(mContext,"text", Toast.LENGTH_SHORT);
t.show();
并在任何地方使用t.cancel();