import android.app.Activity;
import android.content.Context;
import android.widget.Toast;
/**
* Toast 显示帮助类
*/
public class ToastUtils {
public static void show(Context context, String showText, int showTime) {
Toast.makeText(context, showText, showTime).show();
}
public static void show(Context context, String showText) {
Toast.makeText(context, showText, Toast.LENGTH_SHORT).show();
}
public static void show(final Activity activity, final String showText) {
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(activity, showText, Toast.LENGTH_SHORT).show();
}
});
}
}
}
[Utils工具整理] Toast 显示帮助类
最新推荐文章于 2023-09-21 16:08:20 发布