开发者

Why don't we have ArrayAdapter's notifyDataSetChanged(row)

开发者 https://www.devze.com 2023-03-22 19:00 出处:网络
When I am doing Swing programming, javax.swing.table.AbstractTableModel is having fireTableCellUpdated(row, col), to let me specific which row and col of GUI I want to update.

When I am doing Swing programming, javax.swing.table.AbstractTableModel is having fireTableCellUpdated(row, col), to let me specific which row and col of GUI I want to update.

However, 开发者_StackOverflow社区when comes to ArrayAdapter, I realize they only provide notifyDataSetChanged. I was expecting I am having access to notifyDataSetChanged(row), to let me update the item I am interested in. I do not want to update the entire list.

I was wondering why don't we have ArrayAdapter's notifyDataSetChanged(row). Or, am I missing something?


I was wondering why don't we have ArrayAdapter's notifyDataSetChanged(row).

Ask Google. ;-)

Or, am I missing something?

Nope.

You are (by calling notifyDataSetChanged()) just telling the ListView to redraw the whole list, even if you just have to update a specific item. I believe Google have a good reason for why this was omitted, but as it stands, you are perfectly fine with calling notifyDataSetChanged().


notifyDataSetChanged() does not take effect on specific child view, as you are asking. It sends signal for the listview/tablerows to be repopulated with new data. Therefore, entire View is told to redrawn with the new data using this method.

Watch this video to get more familiar adapters. http://www.youtube.com/watch?v=wDBM6wVEO70

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号