Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash On RecyclerView Refresh #223

Open
tyforcode opened this issue Jul 2, 2017 · 0 comments
Open

Crash On RecyclerView Refresh #223

tyforcode opened this issue Jul 2, 2017 · 0 comments

Comments

@tyforcode
Copy link

tyforcode commented Jul 2, 2017

Hi,

SuperSLiM's been a great library so far. Unfortunately, a bug came up which I can't seem to figure out. The library and layoutmanager work fine when first set of items. However, the layout manager crashes when "notifyItemChanged" is called from the adapter. The dataset I'm using happened to have alternating header/content entries. The current work around I'm using entails creating a new adapter with the new data and replacing the old one attached to the RecyclerView like so:

list.setAdapter(null); listAdapter = new ListAdapter(newData); list.setAdapter(listAdapter);

The support library I'm using is version 25.3.1. Here's the full stack trace:

java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.ViewGroup$LayoutParams android.view.View.getLayoutParams()' on a null object reference at android.support.v7.widget.RecyclerView$LayoutManager.getPosition(RecyclerView.java:7949) at com.tonicartos.superslim.LayoutManager.onItemsUpdated(LayoutManager.java:530) at android.support.v7.widget.RecyclerView$LayoutManager.onItemsUpdated(RecyclerView.java:9366) at android.support.v7.widget.RecyclerView$6.dispatchUpdate(RecyclerView.java:863) at android.support.v7.widget.RecyclerView$6.onDispatchSecondPass(RecyclerView.java:874) at android.support.v7.widget.AdapterHelper.consumeUpdatesInOnePass(AdapterHelper.java:570) at android.support.v7.widget.RecyclerView.processAdapterUpdatesAndSetAnimationFlags(RecyclerView.java:3256) at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:3050) at android.view.View.measure(View.java:18794) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461) at android.view.View.measure(View.java:18794) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.view.View.measure(View.java:18794) at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1658) at android.view.View.measure(View.java:18794) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461) at android.view.View.measure(View.java:18794) at android.support.v4.widget.DrawerLayout.onMeasure(DrawerLayout.java:1081) at android.view.View.measure(View.java:18794) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.view.View.measure(View.java:18794) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465) at android.widget.LinearLayout.measureVertical(LinearLayout.java:748) at android.widget.LinearLayout.onMeasure(LinearLayout.java:630) at android.view.View.measure(View.java:18794) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.view.View.measure(View.java:18794) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139) at android.view.View.measure(View.java:18794) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465) at android.widget.LinearLayout.measureVertical(LinearLayout.java:748) at android.widget.LinearLayout.onMeasure(LinearLayout.java:630) at android.view.View.measure(View.java:18794) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.view.View.measure(View.java:18794) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465) at android.widget.LinearLayout.measureVertical(LinearLayout.java:748) at android.widget.LinearLayout.onMeasure(LinearLayout.java:630) at android.view.View.measure(View.java:18794) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at com.android.internal.policy.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2643) at android.view.View.measure(View.java:18794) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2100) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1216)

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

No branches or pull requests

1 participant