i am getting a javalangruntimeexception error in my android application

Your MapView isn’t a fragment, it’s a View subclass so look into this answer

With Kotlin you should be able to just use mapView in your code without even finding it.

The RuntimeException occurs because findFragmentById returns null and you specify that you can’t accept null using !!. The casting also wouldn’t work because it’s a View.

Edit: Actually, before looking at that answer just try calling mapView in your code first, if it works you don’t create unnecessary code and it’s less confusing

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top