I defined the image representation programmatically and updated it asynchronously with the images downloaded from the web service.
Now I want to add a progress bar to the image view so that the image displays a progress bar before loading the image. I did not define the image in the xml file because I am updating it in horizontal scrolling.
Please help him in despair ... !!!
Here is the code that I update the image view
protected ImageView asImageView(final String message,final String path){
final ImageView iv=new ImageView(this);
AsyncImageLoaderv asyncImageLoaderTop = new AsyncImageLoaderv();
Bitmap cachedImageTop=
asyncImageLoaderTop.loadDrawable(
path, new AsyncImageLoaderv.ImageCallback() {
public void imageLoaded(Bitmap imageDrawable,
String imageUrl) {
iv.setImageBitmap(imageDrawable);
}
});
iv.setImageBitmap(cachedImageTop);
iv.setScaleType(ImageView.ScaleType.FIT_XY);
LinearLayout.LayoutParams params= new LinearLayout.LayoutParams(100,120);
params.setMargins(10, 10, 10, 10);
iv.setLayoutParams(params);
iv.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
startActivity(new Intent(getApplicationContext(),
ShowPhotoActivity.class).putExtra("imagePath",
path).putExtra("message", message));
}
});
return iv;
}
source
share