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

Working bad with Fragments #101

Open
smedic opened this issue Jan 30, 2019 · 0 comments
Open

Working bad with Fragments #101

smedic opened this issue Jan 30, 2019 · 0 comments
Labels

Comments

@smedic
Copy link

smedic commented Jan 30, 2019

I really like this library but it works really bad with fragments, especially with fragments inside ViewPager.
For instance, we must use handler and postDelayed to delay animation until fragment transition is completed, but it constantly fails with error
java.lang.NullPointerException: Attempt to invoke virtual method 'float android.text.Layout.getLineLeft(int)' on a null object reference

java.lang.IllegalStateException: Fragment SomeFragment{xxxxx} not attached to a context.

due to fragment lifecycle and missing activity context.

I tried to use Handler as instance variable and remove handler callbacks when fragment is detached but same thing happens every time.
It looks like impossible mission to use it properly without destabilizing the whole app.

Any idea how to use it in smart way inside fragments?

Imagining that we need postDelayed to use something provided in library is really bad approach. You should handle that inside of library and not force users to handle manually.

It works good in activities.

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

No branches or pull requests

2 participants