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

RuntimeException when calling viewGroup.addView(scrollBarView) #90

Open
PtiPingouin opened this issue Mar 30, 2017 · 7 comments
Open

RuntimeException when calling viewGroup.addView(scrollBarView) #90

PtiPingouin opened this issue Mar 30, 2017 · 7 comments

Comments

@PtiPingouin
Copy link

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)

@turing-tech
Copy link
Owner

I'm not getting a crash on the example project. Would you mind providing more of the code before and after your addView() call?

@PtiPingouin
Copy link
Author

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.

@qiminl
Copy link

qiminl commented May 23, 2017

I got this issue as well

@chanonly123
Copy link

Its in MaterialScrollBar.java -> generalSetup() -> a.recycle() causing the crash. Use MaterialScrollBar in xml to bypass this bug.

@silent10
Copy link

I am getting the same error for the same reason!

@turing-tech
Copy link
Owner

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 ;)

@ln-12
Copy link

ln-12 commented May 6, 2018

I'm also having this issue. In my case this always happens, when I want to enter the popup window mode on samsung devices as described here and here.
Surprisingly the native Android Multi-Window-Mode (described here) works fine.

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

No branches or pull requests

6 participants