Fatal Exception: java.lang.IllegalStateException
See original GitHub issuePlease complete the following information:
- Library Version
1.2.9
- Affected Device(s)
Samsung, Xiaomi, HUAWEI, OPPO
OS 8,9,10
The Bug:
I’m using only showAlignTop
method, but in some cases this crash is popping on my Firebase Crashlytics.
The specified child already has a parent. You must call removeView() on the child's parent first.
Fatal Exception: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
at android.view.ViewGroup.addViewInner(ViewGroup.java:5106)
at android.view.ViewGroup.addView(ViewGroup.java:4935)
at android.view.ViewGroup.addView(ViewGroup.java:4907)
at android.widget.PopupWindow.createBackgroundView(PopupWindow.java:1530)
at android.widget.PopupWindow.preparePopup(PopupWindow.java:1492)
at android.widget.PopupWindow.showAsDropDown(PopupWindow.java:1417)
at android.widget.PopupWindow.showAsDropDown(PopupWindow.java:1380)
at com.skydoves.balloon.Balloon$showAlignTop$$inlined$show$1.run(Balloon.java:1774)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7403)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)
Possible solution:
Was not able to full reproduce yet, but maybe we can find the right part of the library and to some parent check, like
if(tv.getParent() != null) {
((ViewGroup)tv.getParent()).removeView(tv); // <- fix
}
layout.addView(tv);
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
java.lang.IllegalStateException: Can not perform this action ...
Fatal Exception : java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState at android.support.v4.app.
Read more >How to Fix The IllegalStateException in Java - Rollbar
An IllegalStateException is a runtime exception in Java that is thrown to indicate that a method has been invoked at the wrong time....
Read more >IllegalStateException - Android Developers
java.lang.Object. ↳, java.lang.Throwable. ↳, java.lang.Exception. ↳, java.lang.RuntimeException. ↳, java.lang.IllegalStateException ...
Read more >How to Solve java.lang.IllegalStateException in Java main ...
IllegalStateException is the child class of RuntimeException and hence it is an unchecked exception. This exception is rise explicitly by ...
Read more >java.lang.IllegalStateException: could not load open ssl
We have an Android app that is hosted internally via Workspace ONE UEM. It uses the Android SDK 21.11 and is working well....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
100% safe @skydoves thanks for the fast responsive on this. muzmatch working like an charm
@Canato Hmm… I think the balloon should be shown when the
contentView
has no parent view for preventing the concurrency issue. I will test and add some more conditions on theshow
method. Thanks for your report 😃