android-advancedrecyclerview icon indicating copy to clipboard operation
android-advancedrecyclerview copied to clipboard

expandableItemManager.notifyItemChanged not updating view in expandable listview

Open kssujithcj opened this issue 9 years ago • 3 comments

Hi,

Thank you for very cool and stable library. I am using this library in my App. I am using expandable recyclerview(demo_e example) in one of my fragments. Issue I have is,

  1. I get data every half a second and I have to update corresponding item view. I tried expandableItemManager and adapter to call notifyItemchanged method but both are not working(not updating recyclerview).
  2. In another fragment, I am using same example where list's array data keeps changing, I have to update view with notifydatasetchanged, even this is not working.

Please let me know, if there is a solution for it or Am I doing it wrong?

Observation: I have custom list data which is passed to adapter in constructor. After sometime I change list in fragment and call notifyItemchanged which will in turn call onBindGroupViewHolder but list in my adapter still has old data.

kssujithcj avatar Mar 21 '16 10:03 kssujithcj

Hi.

Observation: I have custom list data which is passed to adapter in constructor. After sometime I change list in fragment and call notifyItemchanged which will in turn call onBindGroupViewHolder but list in my adapter still has old data.

It seems that you have already reached to the answer yourself. Need to share the same list instance between in fragment and in adapter.

Then call one of these method most appropriate in your situation.

  • Invalidate all items
    • RecyclerView.Adapter.notifyDataSetChanged()
  • Invalidate one group item
    • RecyclerViewExpandableItemManager.notifyGroupItemChanged(int groupPosition)
  • Invalidate one child item
    • RecyclerViewExpandableItemManager.notifyChildItemChanged(int groupPosition, int childPosition)
  • Invalidate children of a group
    • RecyclerViewExpandableItemManager.notifyChildrenOfGroupItemChanged(int groupPosition)
  • Invalidate a group and its children
    • RecyclerViewExpandableItemManager.notifyGroupAndChildrenItemsChanged(int groupPosition)

h6ah4i avatar Mar 26 '16 10:03 h6ah4i

Thank you for the reply. I am using same object which I pass to adapter in fragment. I think it has to do something with my code. I will take a look at it. For now, I am modifying data object in adapter directly from fragment using adapter object and call notify method as mentioned above.

kssujithcj avatar Apr 14 '16 07:04 kssujithcj

how u resolve this issue ? i dnt have exact position for notify , have to pass all updated data to adapter how will i do that ?

engr-erum avatar Oct 19 '18 12:10 engr-erum