Android Toast 简单封装

public final class UIToast {
	
	private static Context context = GoldApp.goldAPP.getApplicationContext();

	public static void showToastLong(String msg) {
		showToast(context, msg, Toast.LENGTH_LONG);
	}

	public static void showToastShort(String msg) {
		showToast(context, msg, Toast.LENGTH_SHORT);
	}

	public static void showToastShort(int strRes) {
		showToast(context, context.getString(strRes), Toast.LENGTH_SHORT);
	}

	public static void showToastLong(int strRes) {
		showToast(context, context.getString(strRes), Toast.LENGTH_LONG);
	}

	public static void showToast(Context context, String msg, int duration) {
		Toast.makeText(context, msg, duration).show();
	}

}



   

你可能感兴趣的:(Android Toast 简单封装)