Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Is it possible to refresh just one item in a listview? [duplicate]

Tags:

I'm wondering if it is possible to rerender just one element in a listview? I assume by calling notifyDatasetChanged() is gonna rerender the whole list?

Thanks,

like image 878
wei Avatar asked Jun 01 '10 21:06

wei


1 Answers

you can't render (refresh) a single row, but instead you can get the requested view and make chages on it directly by calling yourListView.getChildAt(int VisiblePosition); where the visiblePostion is the position in the ListView minus yourListView.getFirstVisiblePosition()

Like this :

    View v = listViewItems.getChildAt(position -              listViewItems.getFirstVisiblePosition());     v.setBackgroundColor(Color.GREEN); 

I hope this helps...

like image 104
Driss Bounouar Avatar answered Oct 12 '22 22:10

Driss Bounouar