Files
GLDriver/mylibrary/src/main/java/com/arpa/mylibrary/utils/ToastUtils.java
T
2024-04-26 16:19:26 +08:00

38 lines
896 B
Java

package com.arpa.mylibrary.utils;
import android.content.Context;
import android.text.TextUtils;
import android.widget.Toast;
/**
* Created by Administrator on 2017/11/28 0028.
*/
public class ToastUtils {
public static Toast mToast = null;
public static void showToast(Context mContext, String message) {
if (!TextUtils.isEmpty(message)) {
// if ( mToast != null) {
// mToast.cancel();
// }
// mToast = Toast.makeText(mContext, message, Toast.LENGTH_SHORT);
// mToast.show();
if (mToast == null) {
mToast = Toast.makeText(mContext, message, Toast.LENGTH_SHORT);
} else {
mToast.setText(message);
}
mToast.show();
}
}
public static void cancelToast(){
if (mToast!=null)
mToast.cancel();
}
}