Android工具类系列-ToastUtil

原文地址:
http://blog.csdn.net/lmj623565791/article/details/38965311

不做过多介绍,就是想每次打印toast的时候不再写那么长一段代码

package org.yxm.android.utils;

import android.content.Context;
import android.widget.Toast;

public class T {

    private T() {
        throw new UnsupportedOperationException("cannot be instantiated");
    }


    public static void showShort(Context context, CharSequence message) {
        Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
    }


    public static void showShort(Context context, int message) {
        Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
    }


    public static void showLong(Context context, CharSequence message) {
        Toast.makeText(context, message, Toast.LENGTH_LONG).show();
    }


    public static void showLong(Context context, int message) {
        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) {
        Toast.makeText(context, message, duration).show();
    }
}

你可能感兴趣的:(Android工具类系列)