今天碰到一个功能需要用glide在线程内进行同步下载图片再进行操作,记录一下
Thread thread = new Thread(){
@Override
public void run() {
super.run();
FutureTarget<Bitmap> futureBitmap = Glide.with(GuideActivity.this).asBitmap()
.load("http://pic8.iqiyipic.com/image/20181124/6a/c1/a_100035270_m_601_m13_180_236.jpg")
.submit();
try {
Bitmap bitmap = futureBitmap.get();
Log.d("===============",bitmap.getWidth() + " x "+bitmap.getHeight());
} catch (ExecutionException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
};
thread.start();