android Toast工具類

以下是自己總結的Toast工具類


public class ToastUtil{

	public static boolean isShow = true;
	
	/**
	*短時間顯示Toast
	*
	**/
	public static void showShort(Context context,CharSequence message){
		if(isShow){
			Toast.makeText(context,message,Toast.LENGTH_SHORT).show();
			}
		}
	

	public static void showShort(Context context,int message){
		if(isShow){
			Toast.makeText(context,message,Toast.LENGTH_SHORT).show();
			}
		}
		
	public static void showLong(Context context,CharSequence message){
		if(isShow){
			Toast.makeText(context,message,Toast.LENGTH_LONG).show();
			}
		}
	
	public static void showLong(Context context,int message){
		if(isShow){
			Toast.makeText(context,message,Toast.LENGTH_LONG).show();
			}
		}
		
	public static void show(Context context,CharSequence message,int duration){
	Toast.makeText(context,message,duration).show();	
		}
		
	public static void show(Context context,int message,int duration){
		if(isShow){
			Toast.makeText(context,message,duration).show();
			}
		}
}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章