HomHomLin / Android-PullToRefreshRecyclerView

A RecyclerView library for Android which support pull-to-refresh ,auto-load-more and add header.
https://github.com/HomHomLin/Android-PullToRefreshRecyclerView
377 stars 101 forks source link

Cannot call this method in a scroll callback. Scroll callbacks might be run during a measure & layout pass where you cannot change the RecyclerView data. Any method call that might change the structure of the RecyclerView or the adapter contents should be postponed to the next frame #29

Open cinohub opened 6 years ago

cinohub commented 6 years ago

I got this error when scroll recyclerview. It drop frame so much. How to fix this ,guy? Thanks!

Cannot call this method in a scroll callback. Scroll callbacks might be run during a measure & layout pass where you cannot change the RecyclerView data. Any method call that might change the structure of the RecyclerView or the adapter contents should be postponed to the next frame. java.lang.IllegalStateException: at android.support.v7.widget.RecyclerView.assertNotInLayoutOrScroll(RecyclerView.java:2458) at android.support.v7.widget.RecyclerView$LayoutManager.assertNotInLayoutOrScroll(RecyclerView.java:6760) at android.support.v7.widget.LinearLayoutManager.assertNotInLayoutOrScroll(LinearLayoutManager.java:1244) at android.support.v7.widget.RecyclerView.removeItemDecoration(RecyclerView.java:1395) at com.lhh.ptrrv.library.PullToRefreshRecyclerView.setHasMoreItems(PullToRefreshRecyclerView.java:334) at com.lhh.ptrrv.library.PullToRefreshRecyclerView.access$800(PullToRefreshRecyclerView.java:22) at com.lhh.ptrrv.library.PullToRefreshRecyclerView$InterOnScrollListener.onScrolled(PullToRefreshRecyclerView.java:389) at android.support.v7.widget.RecyclerView.dispatchOnScrolled(RecyclerView.java:4384) at android.support.v7.widget.RecyclerView.dispatchLayoutStep3(RecyclerView.java:3462) at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3194) at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3627) at android.view.View.layout(View.java:16639) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079) at android.view.View.layout(View.java:16639) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.support.v4.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:636) at android.view.View.layout(View.java:16639) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1735) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1579) at android.widget.LinearLayout.onLayout(LinearLayout.java:1488) at android.view.View.layout(View.java:16639) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079) at android.view.View.layout(View.java:16639) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1735) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1579) at android.widget.LinearLayout.onLayout(LinearLayout.java:1488) at android.view.View.layout(View.java:16639) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at android.view.View.layout(View.java:16639) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1735) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1579) at android.widget.LinearLayout.onLayout(LinearLayout.java:1488) at android.view.View.layout(View.java:16639) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at android.view.View.layout(View.java:16639) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1735) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1579) at android.widget.LinearLayout.onLayout(LinearLayout.java:1488) at android.view.View.layout(View.java:16639) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2934) at android.view.View.layout(View.java:16639) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.view.ViewRootImpl.performLayout(ViewRootImpl.

Fast0n commented 6 years ago

Has anyone solved?