Erik Erik - 11 months ago 68
Android Question

How can I update a single row in a ListView?

I have a

which displays news items. They contain an image, a title and some text. The image is loaded in a separate thread (with a queue and all) and when the image is downloaded, I now call
on the list adapter to update the image. This works, but
is getting called too frequently, since
for all visible items. I want to update just the single item in the list. How would I do this?

Problems I have with my current approach are:

  1. Scrolling is slow

  2. I have a fade-in animation on the image which happens every time a single new image in the list is loaded.

Answer Source

I found the answer, thanks to your information Michelle. You can indeed get the right view using View#getChildAt(int index). The catch is that it starts counting from the first visible item. In fact, you can only get the visible items. You solve this with ListView#getFirstVisiblePosition().


private void updateView(int index){
    View v = yourListView.getChildAt(index - 

    if(v == null)

    TextView someText = (TextView) v.findViewById(;
    someText.setText("Hi! I updated you manually!");