Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

[QUESTION] Updating existing DataManager and ItemBinder of the changes in model or list #56

Open
premacck opened this issue Sep 28, 2018 · 3 comments

Comments

@premacck
Copy link

Is there any way to update just the existing DataManager object and its associated ItemBinder, when the model is updated/changed (in an adapter of multiple DataManagers and ItemBinders)?

@DevAhamed
Copy link
Owner

Hi, 2.x version has been released with this feature. Kindly let me know if its working out for you.

@nidhinek
Copy link

App get crashed while calling notifyDataSetChanged.
I am using 2.x version
Logs
java.lang.ClassCastException: com.bestlaysoft.arivu.viewItems.HeaderItemBinder$HeaderViewHolder cannot be cast to com.bestlaysoft.arivu.viewItems.SingleClassItem$SingleClassViewHolder
at com.bestlaysoft.arivu.viewItems.SingleClassItem.bindViewHolder(SingleClassItem.java:22)
at mva2.adapter.MultiViewAdapter.onBindViewHolder(MultiViewAdapter.java:453)
at mva2.adapter.MultiViewAdapter.onBindViewHolder(MultiViewAdapter.java:66)
at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6986)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5903)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6170)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6009)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6005)
at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2302)
at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1627)
at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1587)
at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:665)
at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4040)
at androidx.recyclerview.widget.RecyclerView.onMeasure(RecyclerView.java:3446)
at android.view.View.measure(View.java:23355)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6758)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1535)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:825)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:704)
at android.view.View.measure(View.java:23355)
at androidx.recyclerview.widget.RecyclerView$LayoutManager.measureChildWithMargins(RecyclerView.java:9261)
at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1653)
at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1587)
at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:665)
at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4040)
at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3757)
at androidx.recyclerview.widget.RecyclerView.consumePendingUpdateOperations(RecyclerView.java:1869)
at androidx.recyclerview.widget.RecyclerView$1.run(RecyclerView.java:412)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1172)
at android.view.Choreographer.doCallbacks(Choreographer.java:984)
at android.view.Choreographer.doFrame(Choreographer.java:806)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1158)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6863)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

@DevAhamed
Copy link
Owner

Hi @nidhinek, It might be because of the incorrect value returned from ItemBinder's (SingleClassItem) 'canBindData()' method.
Note : This is a complete different issue from the original thread, so please file a separate issue if you are still facing any problems.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants