suresh cheemalamudi
suresh cheemalamudi

Reputation: 6240

Android - show progress dialog in imageView (as empty view) until image is downloaded from server

I have a view pager which shows downloaded images from server. While the images are being downloaded I show an empty stub as default.enter image description here

But instead of the stub i wanted progress dialog to be shown here until the image is downloaded. How can i do this?

image display method:

public void DisplayImage(String url, Activity activity, ImageView imageView) {
        imageViews.put(imageView, url);
        Bitmap bitmap = memoryCache.get(url);
        if (bitmap != null)
            imageView.setImageBitmap(bitmap);
        else {
            queuePhoto(url, activity, imageView);
            imageView.setImageResource(stub_id);
        }
    }

Upvotes: 0

Views: 1579

Answers (1)

s.d
s.d

Reputation: 29436

Build a a progress dialog: ProgressDialog.show(context,"loading","loading");

Or

Place the ImageView along with a ProgressBar(preferably the intermediate spinner) in a FrameLayout and switch their visibility via setVisibilty().

Upvotes: 3

Related Questions