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

Current FloatingToolbarMenuBuilder implementation makes the app crash #32

Closed
jahirfiquitiva opened this issue Jul 28, 2017 · 2 comments
Closed
Labels
Milestone

Comments

@jahirfiquitiva
Copy link

If one does not set a menu in layout xml, but builds it and sets it programmatically, the app will crash, because the library calls removeAllViews() for the FloatingToolbar but it is null because there was no menu set before.

@rubensousa
Copy link
Owner

Thank you so much for your help. I've added a check for this in: c7a6c5a

I'll release 1.5.1 with this fix and your other suggestions ;)

@rubensousa rubensousa added this to the 1.5.1 milestone Jul 28, 2017
@rubensousa rubensousa added the bug label Jul 28, 2017
@aminecmi
Copy link

aminecmi commented Nov 11, 2017

@rubensousa I'm having this issue with the 1.5.1 version.

java.lang.RuntimeException: Unable to resume activity {Activity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.LinearLayoutCompat.removeAllViews()' on a null object reference
                                                                                   at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3645)
                                                                                   at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3685)
                                                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2898)
                                                                                   at android.app.ActivityThread.-wrap11(Unknown Source:0)
                                                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
                                                                                   at android.os.Handler.dispatchMessage(Handler.java:105)
                                                                                   at android.os.Looper.loop(Looper.java:164)
                                                                                   at android.app.ActivityThread.main(ActivityThread.java:6541)
                                                                                   at java.lang.reflect.Method.invoke(Native Method)
                                                                                   at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                                                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
                                                                                Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.LinearLayoutCompat.removeAllViews()' on a null object reference
                                                                                   at com.github.rubensousa.floatingtoolbar.FloatingToolbar.setMenu(FloatingToolbar.java:278)
                                                                                   at Activity.onResume(Activity.kt:43)
                                                                                   at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1354)
                                                                                   at android.app.Activity.performResume(Activity.java:7079)
                                                                                   at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3620)

You'll have to create a dummy menu and assign it from the xml file so you could create your menu manually without any crash.

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

3 participants