While TreKing's advice to profile is of course excellent...
...rebuilding the entire {expandable} list view just to update one item is
more work that necessary.
When performance is important, you can walk the list of visible item views,
find the one you need to update, and do it right there. You will want to
use listView.getFirstVisibleItem / getLastVisibleItem / getChild.
Also there is a callback, AbsListView.onScrollListener, which lets you know
when the list view is scrolling, and perhaps suspend your updates if
necessary.
-- K
2013/2/1 saex <[email protected]>
> I have a ExpandableListView with some groups, and each group haves only
> one child, with a string on it.
>
> I have a thread that get's some updated data and *each second* calls a
> handler that updates the string of one of the childs of the
> ExpandableListView and then calls this method to refresh the view and show
> the updated data to the user: ((BaseExpandableListAdapter)
> mAdapter).notifyDataSetChanged();
>
> This is the update handler:
>
> infoUpdateHandler = new Handler(){
> @Override
> public void handleMessage(Message msg) {
> super.handleMessage(msg);
> children[2][0]=getUpdatedInfo();
> ((BaseExpandableListAdapter) mAdapter).notifyDataSetChanged();
> }
> };
>
> The problem is that when i'm scrolling the expandable list view, i can see
> how the scroll is showing low performance, it stops sometimes. I think that
> it is because this call ((BaseExpandableListAdapter)
> mAdapter).notifyDataSetChanged(); is updating all the ExpandableListView.
>
> *Does not exist a better way to update a expandable list view? Maybe a
> way to update only the child that you want to update?*
>
> Thanks
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.