title: Android Kotlin DialogFragment (TimePicker)
body: <p>I'm having problems showing a DialogFragment with Android in Kotlin. This is what I got so far:</p>
  
  <p>The <code>TimePickerFragment.kt</code></p>
  
  <pre><code>package de.flokol120.UniversalSleepTimer
  
  import android.app.Dialog
  import android.app.DialogFragment
  import android.widget.TimePicker
  import android.app.TimePickerDialog
  import android.os.Bundle
  import android.text.format.DateFormat
  import java.util.*
  
  
  /**
   * @author flokol120
   * TimePicker Fragment to get the time
   */
  class TimePickerFragment : DialogFragment(), TimePickerDialog.OnTimeSetListener {
  
      override fun onCreateDialog(savedInstanceState: Bundle): Dialog {
          val c = Calendar.getInstance()
          val hour = c.get(Calendar.HOUR_OF_DAY)
          val minute = c.get(Calendar.MINUTE)
  
          return TimePickerDialog(getActivity(), this, hour, minute,
                  DateFormat.is24HourFormat(getActivity()))
      }
  
      override fun onTimeSet(view: TimePicker, hourOfDay: Int, minute: Int) {
          //TODO add this
      }
  }
  </code></pre>
  
  <p>and the <code>AddTimer.kt</code></p>
  
  <pre><code>package de.flokol120.UniversalSleepTimer
  
  import android.os.Bundle
  import android.support.v4.app.Fragment
  import android.view.LayoutInflater
  import android.view.View
  import android.view.ViewGroup
  import android.widget.Button
  
  
  /**
   * @author flokol120
   * the fragment which adds a simple kill Timer
   */
  class AddTimer : Fragment() {
  
      lateinit var timePicker : Button
  
      override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?,
                                savedInstanceState: Bundle?): View? {
          val v = inflater!!.inflate(R.layout.fragment_add_timer, container, false)
  
          timePicker = v.findViewById(R.id.timePicker)
  
          timePicker.setOnClickListener {
              val newFragment = TimePickerFragment()
              newFragment.show(fragmentManager, "timePicker")
          }
  
          return v
      }
  
  }
  </code></pre>
  
  <p>I also tried replacing the <code>fragmentManager</code> with <code>this@AddTimer.fragmentManager</code> but this doesn't seem to be the solution.</p>
  
  <p>I am pretty clueless now because Android Studio says I have to use an <code>FragmentManager!</code> as first parameter but I am using one, right?</p>