How do I optimize my app? After fetching the data from api and display in ListView I experiencing lag

Are you sure the lag is because this function of build list elements?
How many elements you have?
or it's because the time of fetch data from internet?

and how big are your images ?

the default size of the list view if you put images


how to resize the image from API?

I tried to remove images, and the lag has gone. How to resize the images before it shows in listview?

It would be better to create a set of size optimised images at the same location as your "full sized" images (otherwise you will be waiting for the resizing and the downloading), and use them for your listview, then if you need to view the full size image, supply the url / path for that from the listview image.

You did not answer this.

If you have too many images to download, you need to downsize the images from server side, not on app side.

Or you can use other extension (like picasso) to load the images asynchronously. but in this way you can not use build-in listView. You have to make you own listView using extension (like CompCreator) to create the custom layout by your self.

1 Like

I have 20 elements