title: how to handle back pressed in Kotlin
body: <p>my app having only two base activity and several fragment,, i want to display an Exit alert when user reach particular base fragment by clicking back press</p>
  
  <pre><code>override fun onBackPressed() {
          if (drawer_layout.isDrawerOpen(GravityCompat.START)) {
            drawer_layout.closeDrawer(GravityCompat.START)
  
          } else {
           // super.onBackPressed()
              AlertDialog.Builder(this)
                  .setTitle("Exit Alert")
                  .setMessage("Do You Want To Exit Petals App?")
                  .setPositiveButton(android.R.string.ok) { dialog, whichButton -&gt;
                      super.onBackPressed()
                  }
                  .setNegativeButton(android.R.string.cancel) { dialog, whichButton -&gt;
  
                  }
                  .show()
  
          } 
  </code></pre>
  
  <p>i used addtosatck on each fragment </p>