Created my adapter based on BaseAdapter. My ListView has TextView and ImageView. I upload pictures from the network (in AsyncTask). Everything is great on my sheet is very large and hundreds of pictures ... so my entire sheet is displayed only when all the pictures are loaded .. And I want to first display the text (it loads quickly), and then add them one by one to my ListView as the pictures are loaded . Is it even possible to implement? Suppose initially I set the value null instead of pictures, but then how can I update the sheet and add pictures? Who can still any simple implementations prompts.
- If you are given an exhaustive answer, mark it as correct (a daw opposite the selected answer). - Nicolas Chabanovsky ♦
4 answers
Make your object. Pull url into it.
class Model { private String url; private String text; /*getter and setter*/ } Create a list of list models ListModels = .... transfer to the adapter and there already pictures through Piccaso load asynchronously and everything will work well the pictures will be cached
- Here, this is just what I needed. I could not guess what should be done in the adapter itself. Thank you very much, earned! - Michael
If it's not forbidden, then I would advise you to use the Piccaso library to upload photos. At the office. the page has a fairly detailed how-to. Thus, you don’t have to write a bike and save yourself from custom, probably with bugs, implementation.
- How to upload an image is the second question, at the moment I have a ListView quickly displayed, in which the TextView is already filled, but the ImageView is still empty (null), the question is, can I now go through separately on ImageView (for each item) and fill it with pictures ... (no matter how I load them, but for example using Piccaso via AsynkTask) - Mikhail
- Picasso will give me a chance to quickly upload a picture by the URL and add it by id to the ImageView, and how can I go through the imageview of each item in the list and add images gradually to an entire item - Michael
I use the Universal Image Loader; it can load images in several streams at once. And while the pictures are loaded sets the images stub.
You need to organize the addition of data to the adapter via AsynkTask, and to download images, use picasso or UIL.