public static void getRoundedBitmapFromServer(final ImageView targetIcon, String downloadUrl, final int iconWidth, final int iconHeight)
{
ImageLoader imageLoader = ImageLoader.getInstance();
DisplayImageOptions options = new DisplayImageOptions.Builder()
.cacheInMemory(true)
.resetViewBeforeLoading(true)
.build();
SimpleImageLoadingListener imageDownloadListener = new SimpleImageLoadingListener()
{
@Override
public void onLoadingStarted(String imageUri, View view)
{
}
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage)
{
((ImageView) view).setImageBitmap(BeehiveUtils.getRoundedBitmap(loadedImage, iconWidth, iconHeight));
// targetIcon.setImageBitmap(BeehiveUtils.getRoundedBitmap(loadedImage, iconWidth, iconHeight));
/**
* following show the difference between original image and cropped image
**/
// ((ImageView) view).setBackgroundDrawable(new BitmapDrawable(activity.getResources(), loadedImage));
}
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason)
{
}
@Override
public void onLoadingCancelled(String imageUri, View view)
{
}
};
imageLoader.displayImage(downloadUrl, targetIcon, options, imageDownloadListener);
// imageLoader.loadImage(downloadUrl, options, imageDownloadListener);
}
'프로그래밍 > Android' 카테고리의 다른 글
Android getBitmapFromServer(서버에서 이미지 데이터를 가져와 비트맵으로 반환) (0) | 2015.03.02 |
---|---|
Android TextView 기본 여백 없애기 (0) | 2015.02.26 |
Android ViewPager PageAdapter notifyDataSetChanged (0) | 2015.02.25 |
Android Task Summary (0) | 2015.02.22 |
Android 비트맵의 라운드 처리 (0) | 2015.02.17 |
댓글