Skip to content

Fix frameLayoutlayoutChildren crash#71

Closed
hearsilent wants to merge 1 commit into
sephiroth74:masterfrom
hearsilent:bugfix
Closed

Fix frameLayoutlayoutChildren crash#71
hearsilent wants to merge 1 commit into
sephiroth74:masterfrom
hearsilent:bugfix

Conversation

@hearsilent

@hearsilent hearsilent commented Jan 3, 2017

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor Author

@sephiroth74 Can you check about this? Thx :)

@sephiroth74

Copy link
Copy Markdown
Owner

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

@hearsilent

Copy link
Copy Markdown
Contributor Author

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

@sephiroth74

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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

iceteahh commented Mar 5, 2018

Copy link
Copy Markdown

Did it fix?

@eduardbosch

Copy link
Copy Markdown

@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

iceteahh commented Apr 4, 2018

Copy link
Copy Markdown

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

@indra452

indra452 commented Feb 1, 2019

Copy link
Copy Markdown

@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
Copy Markdown
Owner

Can you resolve the conflict?

@jimoshusheng jimoshusheng left a comment

Copy link
Copy Markdown

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
Copy Markdown
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