Toast消息不重复显示
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();