MaterialScrollBar
MaterialScrollBar copied to clipboard
RuntimeException when calling viewGroup.addView(scrollBarView)
I jumped from 12.3.1 to 12.3.5, and now, I get "RuntimeException: Cannot make calls to a recycled instance!" when calling viewGroup.addView(scrollBarView).
java.lang.RuntimeException: Cannot make calls to a recycled instance! at android.content.res.TypedArray.hasValue(TypedArray.java:1008) at com.turingtechnologies.materialscrollbar.MaterialScrollBar.implementPreferences(MaterialScrollBar.java:190) at com.turingtechnologies.materialscrollbar.MaterialScrollBar$2.run(MaterialScrollBar.java:133) at com.turingtechnologies.materialscrollbar.MaterialScrollBar.generalSetup(MaterialScrollBar.java:244) at com.turingtechnologies.materialscrollbar.MaterialScrollBar.onAttachedToWindow(MaterialScrollBar.java:229) at android.view.View.dispatchAttachedToWindow(View.java:15509) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2916) at android.view.ViewGroup.addViewInner(ViewGroup.java:4456) at android.view.ViewGroup.addView(ViewGroup.java:4258) at android.view.ViewGroup.addView(ViewGroup.java:4198)
I'm not getting a crash on the example project. Would you mind providing more of the code before and after your addView() call?
The reason I'm removing / adding back the scrollbar from the viewgroup is because I never was able to just hide it (neither setVisibility(GONE) nor setScrollBarHidden(false) works for me). So the crash occurs after I removed the view once, then simply try to add it back to the same parent. Simple call to View.remove() and View.add(). Nothing fancy here.
I got this issue as well
Its in MaterialScrollBar.java -> generalSetup() -> a.recycle() causing the crash. Use MaterialScrollBar in xml to bypass this bug.
I am getting the same error for the same reason!
I have gotten several reports of setVisibility(GONE) and setScrollBarHidden(false) not working. However, I myself am unable to replicate them. A code sample from anyone having this issue would be greatly appreciated. I'll even put the lucky winner in the README ;)