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-圖像 - 進入 - 一個位圖) –