Toast.matkText才会创建一个新的实例
private Toast toast = null; private void checkToastResult() { if (toast != null) { toast.setText("没有搜索结果"); toast.setDuration(Toast.LENGTH_SHORT); } else { toast = Toast.makeText(context, "没有搜索结果", Toast.LENGTH_SHORT); } toast.show(); }
原文地址:https://www.cnblogs.com/anni-qianqian/p/8351128.html
时间: 2024-11-04 11:38:39