-
Notifications
You must be signed in to change notification settings - Fork 91
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
Support Map Fragment is null if setContentView is not called #15
Comments
On looking further into this, I released this is happening because the So everything in onCreate() which expects the views to be already on the screen and rendered are not present at all. Seems like this is how lifecycle observer is supposed to work. So this way of view-binding wont work for me. setContentView needs to be called after super.onCreate and not somewhere after or in the middle of onCreate() execution. Is there someway this can be done? |
There are few options you can use here.
|
Take a look in the updated README |
Option 1 is good. I'd forgotten about onPostCreate. But I'm gonna go with option 2 for now as it'll need minimum changes. Thanks. |
Thanks for this library. I just integrated it into an activity with a map.
and then in onCreate, I did not called setContentView as was mentioned in the documentation.
The problem here is that mapFragment is null. However, if I call setContentView(binding.root) before calling findFragmentById then mapFragment is not null, like this -
What could be the issue?
The text was updated successfully, but these errors were encountered: