自定义toast 显示最新toast不累加时间

/**
* 自定义toast 显示最新toast不累加时间
*/
private Toast toast = null;
private void showTextToast(String msg) {
if (toast == null) {
toast = Toast.makeText(getApplicationContext(), msg,
Toast.LENGTH_SHORT);
} else {
toast.setText(msg);
}
toast.show();
}

你可能感兴趣的:(自定义toast 显示最新toast不累加时间)