title: Why do I get a type mismatch when using "this" on fragment Kotlin
body: <p>I can scan a barcode successfully but I somehow cannot get the result. I found out that since I am calling the barcode scanner in a fragment, I need change my code to use this:</p>
  <pre><code>class AddIerFragment : Fragment() { ....
  
     val intentIntegrator = IntentIntegrator.forFragment(this)
     ....
  }
  </code></pre>
  <p>The problem is, the &quot;this&quot; keyword is not allowed because it gives me an error of</p>
  <pre><code>Type mismatch
  Requred: Fragment
  Found AddIerFragment
  </code></pre>
  <p>See image below.</p>
  <p><a href="https://i.stack.imgur.com/O962P.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/O962P.png" alt="enter image description here" /></a></p>
  <p>I have this code in the fragment</p>
  <pre><code>companion object {
          @JvmStatic
          fun newInstance(param1: String, param2: String) =
              AddIerFragment().apply {
                  arguments = Bundle().apply {
                  }
              }
          private const val CAMERA = 1
          private const val GALLERY = 2
          private const val SCAN = 3
      }
  
  R.id.button_atgScan -&gt; {
                  Dexter.withContext(context!!).withPermissions(
                      Manifest.permission.READ_EXTERNAL_STORAGE,
                      Manifest.permission.CAMERA
                  )
                      .withListener(object: MultiplePermissionsListener {
                          override fun onPermissionsChecked(report: MultiplePermissionsReport?) {
                              report?.let{
                                  if(report!!.areAllPermissionsGranted()) {
                                      
                         
                         
      intentIntegrator.setDesiredBarcodeFormats(IntentIntegrator.ONE_D_CODE_TYPES)
                                      intentIntegrator.setPrompt(&quot;Scan a barcode&quot;)
                                      intentIntegrator.setCameraId(0)
                                      intentIntegrator.setBeepEnabled(false)
                                      intentIntegrator.setBarcodeImageEnabled(true)
                                      intentIntegrator.setOrientationLocked(false)
                                      intentIntegrator.initiateScan()
  
                                  }
                              }
  
                          }
  
                          override fun onPermissionRationaleShouldBeShown(
                              p0: MutableList&lt;PermissionRequest&gt;?,
                              p1: PermissionToken?
                          ) {
                              showRationalDialogForPermission()
                          }
  
                      }).onSameThread().check()
              }
  
  override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
          super.onActivityResult(requestCode, resultCode, data)
          if (requestCode == GALLERY) {
              data?.let {
                  val selectedPhotoUri = data.data
                  file = File(getPath(selectedPhotoUri))
                  gView!!.iv_ier_image.setImageURI(selectedPhotoUri)
              }
          } else if (requestCode == CAMERA) {
              data?.extras?.let {
                  val thumbnail: Bitmap =
                      data.extras!!.get(&quot;data&quot;) as Bitmap
                  file = savebitmap(thumbnail)!!
                  gView!!.iv_ier_image.setImageBitmap(thumbnail)
              }
          }
  
          val result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data)
          if (result != null) {
              if (result.contents == null) {
                  Log.i(&quot;TAG&quot;, &quot;NOTHING&quot;)
              } else {
                  Log.i(&quot;TAG&quot;, result.contents)
              }
          } else {
              super.onActivityResult(requestCode, resultCode, data)
          }
      }
  </code></pre>