use of com.androidnetworking.interfaces.BitmapRequestListener in project Fast-Android-Networking by amitshekhariitbhu.
the class MainActivity method loadImageDirect.
public void loadImageDirect(View view) {
AndroidNetworking.get(URL_IMAGE).setTag("imageRequestTag").setPriority(Priority.MEDIUM).setImageScaleType(null).setBitmapMaxHeight(0).setBitmapMaxWidth(0).setBitmapConfig(Bitmap.Config.ARGB_8888).build().setAnalyticsListener(new AnalyticsListener() {
@Override
public void onReceived(long timeTakenInMillis, long bytesSent, long bytesReceived, boolean isFromCache) {
Log.d(TAG, " timeTakenInMillis : " + timeTakenInMillis);
Log.d(TAG, " bytesSent : " + bytesSent);
Log.d(TAG, " bytesReceived : " + bytesReceived);
Log.d(TAG, " isFromCache : " + isFromCache);
}
}).getAsBitmap(new BitmapRequestListener() {
@Override
public void onResponse(Bitmap response) {
Log.d(TAG, "onResponse Bitmap");
imageView.setImageBitmap(response);
}
@Override
public void onError(ANError error) {
if (error.getErrorCode() != 0) {
// received ANError from server
// error.getErrorCode() - the ANError code from server
// error.getErrorBody() - the ANError body from server
// error.getErrorDetail() - just a ANError detail
Log.d(TAG, "onError errorCode : " + error.getErrorCode());
Log.d(TAG, "onError errorBody : " + error.getErrorBody());
Log.d(TAG, "onError errorDetail : " + error.getErrorDetail());
} else {
// error.getErrorDetail() : connectionError, parseError, requestCancelledError
Log.d(TAG, "onError errorDetail : " + error.getErrorDetail());
}
}
});
}
use of com.androidnetworking.interfaces.BitmapRequestListener in project Fast-Android-Networking by amitshekhariitbhu.
the class ANImageLoader method makeImageRequest.
protected ANRequest makeImageRequest(String requestUrl, int maxWidth, int maxHeight, ImageView.ScaleType scaleType, final String cacheKey) {
ANRequest ANRequest = AndroidNetworking.get(requestUrl).setTag("ImageRequestTag").setBitmapMaxHeight(maxHeight).setBitmapMaxWidth(maxWidth).setImageScaleType(scaleType).setBitmapConfig(Bitmap.Config.RGB_565).setBitmapOptions(mBitmapOptions).build();
ANRequest.getAsBitmap(new BitmapRequestListener() {
@Override
public void onResponse(Bitmap response) {
onGetImageSuccess(cacheKey, response);
}
@Override
public void onError(ANError anError) {
onGetImageError(cacheKey, anError);
}
});
return ANRequest;
}
Aggregations