title: How to open a DialogFragment written in Kotlin class from a Java class
body: <p>I created a WaterQualityChecksDialogFragment, please correct if I have not written it correctly.</p>
  
  <p>WaterQualityChecksDialogFragment.kt</p>
  
  <pre><code>class WaterQualityChecksDialogFragment : DialogFragment() {
  
  @Inject
  private lateinit var app: App
  
  fun newTargetInstance(): WaterQualityChecksDialogFragment {
      val fragment = WaterQualityChecksDialogFragment()
      return fragment
  }
  
  override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
      app!!.bus.post(ScreenDimEvent(false))
  
      val builder = AlertDialog.Builder(activity!!.applicationContext)
  
      // Get the layout inflater
      val inflater = activity!!.layoutInflater
  
      @SuppressLint("InflateParams")
      val inflatedView = inflater.inflate(R.layout.dialog_water_quality_cheks, null)
  
      builder
              .setView(inflatedView)
              .setCancelable(false)
              /*
               * setPositiveButton and setNeutralButton are also set (and overridden) in {@link #onStart}
               * to stop Android automatically closing the dialog on click
               */
              .setPositiveButton(R.string.fuel_order_signature_dialog_save) { dialog, id -&gt;
  
              }
              .setNeutralButton(R.string.fuel_order_signature_dialog_clear) { dialog, id -&gt;
  
              }
  
  
      val dialog = builder.create()
  
      // Stop touch events outside the dialog from cancelling/dismissing
      dialog.setCanceledOnTouchOutside(false)
  
      return dialog
  }
  
  interface WaterQCChecksDialogListener {
      fun onDialogPositiveClick(dialog: WaterQualityChecksDialogFragment)
  
      fun onDialogNegativeClick(dialog: WaterQualityChecksDialogFragment)
  }
  }
  </code></pre>
  
  <p>ServiceOrderDialogHelper.java</p>
  
  <pre><code>public void showWaterQCChecksDioalog(){
      //Cannot call newTargetInstance() method.
      waterQualityChecksDialogFragment = WaterQualityChecksDialogFragment.newTargetInstance()
  }
  </code></pre>