Android解决重复连续显示Toast

        private Toast toast = null;
	private void showTextToast(String msg)
	{
		if (toast == null)
		{
			toast = Toast.makeText(getApplicationContext(), msg,
					Toast.LENGTH_SHORT);
		}
		else
		{
			//更新之前创建的一个使用makeText()方法的Toast里的文本。也就是说如果不先调用makeText()方法则不会显示
			toast.setText(msg);
		}
		toast.show();
	}

你可能感兴趣的:(Android)