吐司在课堂上不起作用,
这是我的代码:
public class ToastClass {
public ToastClass (Context activity){
callToast(activity);
}
public void callToast(Context activity){
Toast.makeText(activity, "success", Toast.LENGTH_SHORT).show();
}
}
错误我得到这个,
java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
我需要在课堂上做有什么办法吗?
谢谢。