1
我使用glide将其资源ID加载到位图中,并且我想将位图传递给成员函数一个自定义视图类。Glide错误:java.lang.IllegalArgumentException - 您必须在后台线程上调用此方法
这是我的代码:
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();
}
每当我尝试运行它,我得到以下错误:
Unable to start activity ComponentInfo{...}: java.lang.IllegalArgumentException: YOu must call this method on a background thread
我该如何解决这个问题?
可能的重复[如何使用glide将图像下载到位图?](http://stackoverflow.com/questions/27394016/how-does-one-use-glide-to-download-an-图像 - 进入 - 一个位图) –