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

Uncaught exception getLeft() #20

Open
michalsrutek opened this issue Apr 25, 2018 · 3 comments
Open

Uncaught exception getLeft() #20

michalsrutek opened this issue Apr 25, 2018 · 3 comments

Comments

@michalsrutek
Copy link

Hi,

I'm dealing with the following problem:
I start an Activity from which I instantiate a fragment that contains DuoDrawerLayout. From within that fragment I try to call another fragment, but I get

UncaughtException: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getLeft()' on a null object reference
at nl.psdcompany.duonavigationdrawer.views.DuoDrawerLayout.computeScroll(DuoDrawerLayout.java:284)
....

I am pretty sure that I do this after everything has been initialized. Any ideas?

@potalexander
Copy link
Member

potalexander commented Apr 26, 2018

It sounds like your content view is empty. Maybe this happens when you switch fragments? Make sure you add a view within the drawer layout with the tag: 'content' or set it directly with the attribute: 'app:content'.

@michalsrutek
Copy link
Author

michalsrutek commented Apr 27, 2018

Yes, I'm immediately switing to a other fragment, but I believe only after everything has been initialized. Is there a way to programatically check that? Or maybe a callback for when the DuoDrawerLayout is successfully initialized? ... Or maybe adding a null check somewhere would fix this?

@michalsrutek
Copy link
Author

I am still not sure what is the cause... But I was able to get a workaround by calling
menuDrawer.getContentView(); in the fragment from which I want to immediately switch to another one. menuDrawer is DuoDrawerLayout. And by the way, I'm using AndroidAnnotations 4.4.0 with this.

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

No branches or pull requests

2 participants