盒子
盒子
文章目录
  1. ToastUtil

常用

ToastUtil

public class ToastUtil {
private static String TAG = ToastUtil.class.getSimpleName();

public static void init() {}

public static void show(final Context context, final String msg) {
show(context, msg, Toast.LENGTH_SHORT);
}

public static void show(final Context context, final String msg, final int duration) {
if (Looper.myLooper() == Looper.getMainLooper()) {
Toast.makeText(context, msg, duration).show();
return;
}
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
Toast.makeText(context, msg, duration).show();
}
});
}
}
支持一下
扫一扫,支持一下
  • 微信扫一扫
  • 支付宝扫一扫