title: What is the best practice of Global Dialog in my Application
body: <p>I have my Custom dialog builder in my app that will trigger from many events like: Asynctasks, web service messages, UI input error or from services that don't have activity context. I always used to create a Activity called <code>currentActivity</code> in my Application class. then on resume of every activities their sit on <code>currentActivity</code>.</p>
  
  <pre><code>  @Override
      protected void onResume() {
          super.onResume();
          MyApplication.currentActivity = MainActivity.this;
  </code></pre>
  
  <p>then in case of create dialogs I used that context. but I had one problem. for example I opened RegisterActivity and then <code>currentActivity</code> changed to it. then when app goto background or some case that some other activity opened, my app will crash on creating dialog with that Context. so handling witch Activity is <code>currentActivity</code> is a headache. I googled and find that some guys embed the CustomDialog in an non-layout activty and then open that activity. but it seems to not good solution.</p>
  
  <p><strong>UPDATED</strong></p>
  
  <p>for example I have a SMSManager class that handle my all sending sms. I wanna open dialog to user chose some custom options before sending sms.</p>
  
  <p>so what is the best practice of Global Dialog in my whole application? </p>