hasStableIds () in Expandable ListView?
Asked Answered
K

1

11

I am creating app Using ExpandableListView ,I referred some tutorials .The hasStableIds () set to false? what is the exact need for making hasStableIds() to false?

Katharinakatharine answered 24/6, 2014 at 11:27 Comment(0)
F
17

Documentation of hasStableIds()

Indicates whether the child and group IDs are stable across changes to the underlying data.

Returns whether or not the same ID always refers to the same object

It's used when you change the data of the Adapter, everytime you change the data the ExpandableListView should update it's views to reflect the changes.

If true the ExpandableListView can reuse the same View if the ID is the same.

If false it should recreate all the views since it can't have any idea what changes.

The ID which i refer is the ID returned by getGroupId and getItemId.

You should override this methods too!

Some questions:

Feltner answered 24/6, 2014 at 12:18 Comment(1)
I think you meant getChildId instead of getItemId.Olmsted

© 2022 - 2024 — McMap. All rights reserved.