废话不说,直接上代码,很简单的~~~
public class ToastUtil {
private static Toast toast;
/**
* @param context 上下文环境
* @param content 打印文本内容
*/
public static void show(Context context, String content) {
if (toast == null) {
toast = Toast.makeText(context, content, Toast.LENGTH_SHORT);
} else {
toast.setText(content);
}
toast.show();
}
}
网友评论