Android 防止多次點選,Toast重複顯示

yangxi_001發表於2014-07-07

//防止多次點選,Toast重複顯示

private Toast toast;

private void showToast(String msg) {
if (toast == null) {
toast = Toast.makeText(getApplicationContext(), msg,
Toast.LENGTH_SHORT);
} else {
toast.setText(msg);
}
toast.show();
}

相關文章