There is an application that receives text and base64 images in json format from an external database.

If you load all objects from the database, it loads for a long time. Therefore, I want to load the text first, and the pictures from the database should drag in the background, that is, a ListView with text and an empty space under the pictures is already formed. I do through AsynchTask . I can not figure out how I can implement the background loading only images.

Saw the exact same Android question . Custom ListView (text + image). How to display the text first, then the image , but the answer there is not quite expanded, I didn’t quite get it, but I don’t take part in the discussion for noob :)

I would appreciate an example.

    1 answer 1

    Load the pictures in a separate thread, update the data in your adapter and do notifyDataSetChanged() .

    • please specify, I have now onPostExecute like this: protected void onPostExecute (Void result) {super.onPostExecute (result); SimpleAdapter adapter = new SimpleAdapter (MainActivity.this, data, R.layout.item, new String [] {"brand", "price", "model", "img"}, new int [] {R.id.textView6 , R.id.textView4, R.id.textView5, R.id.imageView1}); lv.setAdapter (adapter); if (pBar.isShown ()) pBar.setVisibility (View.INVISIBLE);} So, I need to make a separate AT and call it onPostExecute from this? - Dmitriy
    • Problem solved, thanks - Dmitriy