title: How to get permission result from activity in fragment?
body: <p>I have <code>MapFragment</code> and I check for permission at <code>onViewCreated</code>:</p>
  <pre><code>  if (uiCommunicationListener.isLocationPermissionGranted()) {
          permission_button.visibility = View.GONE
          val mapFragment =
              childFragmentManager.findFragmentById(R.id.map) as SupportMapFragment?
          mapFragment?.getMapAsync(callback)
      } else {
          //Hide Map
      }
  </code></pre>
  <p><code>uiCommunicationListener</code> is an interface that responsible for fragments-activity communication.</p>
  <p><code>isLocationPermissionGranted</code> located in <code>MainActivity</code> and looks like this:</p>
  <pre><code>override fun isLocationPermissionGranted(): Boolean {
      if (ContextCompat.checkSelfPermission(
              this,
              android.Manifest.permission.ACCESS_FINE_LOCATION
          ) != PackageManager.PERMISSION_GRANTED) {
          //  Ask for permission
          ActivityCompat.requestPermissions(
              this,
              arrayOf(android.Manifest.permission.ACCESS_FINE_LOCATION),
              Constants.LOCATION_PREMMISION_CODE
          )
          return false
      } else {
          // Permission has already been granted
          return true
      }
  </code></pre>
  <p>Basically it is checking if permission is granted, if it is return true, if it's not ask for permission and return false.</p>
  <p>The problem is that I can't do operation based on user action after we ask him for permissions.</p>
  <p>In my case I'm checking if permission has been granted, if it is show the map if it's not hide the map.</p>
  <p>But if it return false, and after the request permission dialog pops up and the user grant us permission, nothing happen because we already &quot;Passed&quot; the if check</p>
  <p>Now Usually in <code>onRequestPermissionsResult</code> method I can make operation based on user actions(Grant us permssion/Deny the request) but here this method lives inside MainActivity and I can't get access to the request code, grant result etc.</p>
  <p>How can I make operations in the fragment based on the result of request permission dialog?</p>