title: Kotlin with Map in Android
body: <pre><code>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
  }
  </code></pre>
  
  <p>Logcat :</p>
  
  <pre><code>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)
  </code></pre>
  
  <p>on this line the error is showing :</p>
  
  <pre><code>mapFragment= fragmentManager.findFragmentById(R.id.map) as SupportMapFragment
  </code></pre>