title: How to create a popup window for confirmation while exiting an app in android when working wth multiple activities
body: <p>I'm working with many activities in Android.
  What I need is, while exiting the app, it should pop up a confirmation to exit or not.
  I know to create a popup window without using any .xml file only in java.
  I also know how to do the following thing while working with only one activity or from a click event.
  But in case of multiple activities and by clicking back button, it is not working.</p>