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

Fix frameLayoutlayoutChildren crash #71

Closed
wants to merge 1 commit into from

Conversation

hearsilent
Copy link
Contributor

@hearsilent hearsilent commented Jan 3, 2017

When use this lib in RecyclerView or ListView etc..., sometimes will crash at FrameLayout.
If you test this crash by yourself maybe you should test 1,000 times or more.

In my app, this crash is a fatal issue.
4

You can see the crash like this:

Fatal Exception: java.lang.NullPointerException
       at android.widget.FrameLayout.layoutChildren(FrameLayout.java:405)
       at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
       at android.view.View.layout(View.java:15749)
       at android.view.ViewGroup.layout(ViewGroup.java:4880)
       at android.support.v4.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:596)
       at android.view.View.layout(View.java:15749)
       at android.view.ViewGroup.layout(ViewGroup.java:4880)

It crash place depends on your Android os.

I try to find this crash for three months.
Finally, I fixed it.

Cheers,
HearSilent

@hearsilent
Copy link
Contributor Author

@sephiroth74 Can you check about this? Thx :)

@sephiroth74
Copy link
Owner

Curious about why delaying the removal of the view should fix the crash.

@hearsilent
Copy link
Contributor Author

I find the solution in here.
bgogetap/StickyHeaders#23

@sephiroth74
Copy link
Owner

So you're saying that this is happening only when the tooltip is used inside a Recyclerview?
In this case why don't you setup the delay in the app itself for hiding/removing the tooltip? I'm saying this because I don't like to have a removeFromParent method which actually doesn't remove.

@hearsilent
Copy link
Contributor Author

I think it happened when calling notifyDataSetChanged().
Maybe it's not the best solution, but I've not any idea to solve it.

@eduardbosch
Copy link

I was looking for this fix also, but I haven't taken a look at PRs 😭
I've found only a closed issue #28 I think is a good idea to link issues in order to find solutions easily.

I'have also fixed the issue in a similar way, but only posting the parent remove if the layout is requested.

You can take a look a more detailed explanation of the problem in my PR #93

@iceteahh
Copy link

iceteahh commented Mar 5, 2018

Did it fix?

@eduardbosch
Copy link

@iceteahh I'm using my PR and I think that the problem has not reappeared
#93

You can use jitpack with this commit:

compile 'com.github.eduardbosch:android-target-tooltip:8855dc3457'

https://jitpack.io/#eduardbosch/android-target-tooltip/8855dc3457

@iceteahh
Copy link

iceteahh commented Apr 4, 2018

@eduardbosch I'm using your PR too. Problem seem to be fixed. Thanks you.

@indra452
Copy link

indra452 commented Feb 1, 2019

@eduardbosch I am currently using this on RecyclerViewAdapter

implementation 'it.sephiroth.android.library.targettooltip:target-tooltip-library:1.3.15'

And got so many FrameLayout Crashes,

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getVisibility()' on a null object reference
       at android.widget.FrameLayout.layoutChildren(FrameLayout.java:275)
       at android.widget.FrameLayout.onLayout(FrameLayout.java:261)

Shall i use

compile 'com.github.eduardbosch:android-target-tooltip:8855dc3457'

Will it be compatible ?

Thanks in advance.

@sephiroth74
Copy link
Owner

Can you resolve the conflict?

Copy link

@jimoshusheng jimoshusheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it works

@hearsilent
Copy link
Contributor Author

It seems like not crash in latest version anymore.

@hearsilent hearsilent closed this Dec 28, 2020
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

Successfully merging this pull request may close these issues.

6 participants