override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View {
var view: View = inflater?.inflate(R.layout.map_fragment, null)!!
var mapFragment : SupportMapFragment?=null
mapFragment= fragmentManager.findFragmentById(R.id.map) as SupportMapFragment
mapFragment.getMapAsync(this)
return view
}
Logcat :
FATAL EXCEPTION: main
kotlin.TypeCastException: null cannot be cast to non-null type
com.google.android.gms.maps.SupportMapFragment
at example.com.kotlinexamplebydimple.Mapfragment.onCreateView(Mapfragment.kt:36)
on this line the error is showing :
mapFragment= fragmentManager.findFragmentById(R.id.map) as SupportMapFragment