use of com.zhy.http.okhttp.callback.BitmapCallback in project okhttputils by hongyangAndroid.
the class MainActivity method getImage.
public void getImage(View view) {
mTv.setText("");
String url = "http://images.csdn.net/20150817/1.jpg";
OkHttpUtils.get().url(//
url).tag(//
this).build().connTimeOut(20000).readTimeOut(20000).writeTimeOut(20000).execute(new BitmapCallback() {
@Override
public void onError(Call call, Exception e, int id) {
mTv.setText("onError:" + e.getMessage());
}
@Override
public void onResponse(Bitmap bitmap, int id) {
Log.e("TAG", "onResponseļ¼complete");
mImageView.setImageBitmap(bitmap);
}
});
}
Aggregations