Reputation: 479
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
But i want to progress bar on loading images like this
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
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
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