最好是封装在一个方法里面
方法中做判断
private Toast mtoast;
private void showTextToast(String msg) {
if (mtoast == null) {
mtoast = Toast.makeText(getApplicationContext(), msg,
Toast.LENGTH_SHORT);
} else {
mtoast.setText(msg);
}
mtoast.show();
}
这样就只有一个toast对象