我将使用Glide,加载一个资源ID对应的图片到位图中,并希望把这个位图传递给自定义视图类的成员函数。
以下是我的代码:
每当我尝试运行它时,都会出现以下错误:
以下是我的代码:
try {
Bitmap bm=Glide.
with(getApplicationContext()).
load(mThumbIds[position]).
asBitmap().
into(width, height). // Width and height
get();
drawView.setImg(bm);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
每当我尝试运行它时,都会出现以下错误:
我该如何解决这个问题?无法启动活动 ComponentInfo{...}: java.lang.IllegalArgumentException: 必须在后台线程上调用此方法