Android

个人Android学习总结


Toast消息不重复显示

<pre><code># Toast消息不重复显示 ```java private Toast mToast; //传入字符串的ID public void showToast(int strId) { if (mToast == null) { mToast = Toast.makeText(this, strId, Toast.LENGTH_SHORT); } else { mToast.setText(strId); } mToast.show(); } //传入字符串 public void showToast(String str) { if (mToast == null) { mToast = Toast.makeText(this, str, Toast.LENGTH_SHORT); } else { mToast.setText(str); } mToast.show(); } ```</code></pre>

页面列表

ITEM_HTML