void
void

Reputation: 479

Progressbar on Loading Imageview in Android

In my Android application i am retrieving all the gallery pictures and display in grid view. I have implemented the loading of images on Async task by using following reference link:- http://developer.android.com/training/displaying-bitmaps/process-bitmap.html

It is working fine.

My gridview looks like this

enter image description here

But i want to progress bar on loading images like this

enter image description here

Also if it is easier default image in place of loading images instead of progress bae will be fine.

Please provide me solution to implement this.

Upvotes: 0

Views: 2569

Answers (2)

vicky
vicky

Reputation: 340

To the grid view you inflate the layout (which consisting of progress bar and the image view) instead of just the image view i.e is in the getview method of the adapter class And pass progress bar id as parameter to each asyc class, in onpreExecute method make it visible,and on postexecute make it visibality gone

Upvotes: 0

bclymer
bclymer

Reputation: 6771

Consider using this library, it allows you to specify in it's options builder

showStubImage(R.drawable.pic_placeholder)

which will appear as the library is loading your image.

https://github.com/nostra13/Android-Universal-Image-Loader

Example usage would be:

// Outside your getView method
picOptions = new DisplayImageOptions.Builder()
            .showStubImage(R.drawable.clip_placeholder)
            .build();

// Inside getView method
ImageLoader.getInstance().displayImage(picUri, imageView, picOptions);

Upvotes: 0

Related Questions