title: What is different between MainActivity.this vs getApplicationContext()
body: <p>I am trying ProgressDialog.But I am confuse.</p>
  
  <p>1.<code>pd=ProgressDialog.show(MainActivity.this, "", "Fething data");</code></p>
  
  <p>when I do use <strong>(MainActivity.this)</strong> then it is ok. But</p>
  
  <p>2.<code>pd=ProgressDialog.show(getApplicationContext(), "", "Fething data");</code></p>
  
  <p>When I do use <strong>(getApplicationContext())</strong> it is ERROR.</p>
  
  <p>What is problem for this progressDialog?</p>
  
  <p>What is different between  (<code>MainActivity.this</code>) vs (<code>getApplicationContext()</code>) </p>
  
  <p>and when I use it perfect time?</p>
  
  <p>For <code>getApplicationContext()</code> Error is:</p>
  
  <pre><code>04-09 15:05:37.453: E/AndroidRuntime(9980): FATAL EXCEPTION: main
  04-09 15:05:37.453: E/AndroidRuntime(9980): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
  04-09 15:05:37.453: E/AndroidRuntime(9980):     at android.view.ViewRootImpl.setView(ViewRootImpl.java:571)
  04-09 15:05:37.453: E/AndroidRuntime(9980):     at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:246)
  04-09 15:05:37.453: E/AndroidRuntime(9980):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
  04-09 15:05:37.453: E/AndroidRuntime(9980):     at android.app.Dialog.show(Dialog.java:281)
  04-09 15:05:37.453: E/AndroidRuntime(9980):     at android.app.ProgressDialog.show(ProgressDialog.java:116)
  04-09 15:05:37.453: E/AndroidRuntime(9980):     at android.app.ProgressDialog.show(ProgressDialog.java:99)
  04-09 15:05:37.453: E/AndroidRuntime(9980):     at android.app.ProgressDialog.show(ProgressDialog.java:94)
  04-09 15:05:37.453: E/AndroidRuntime(9980):     at com.example.shikkok_services.MainActivity$2.onClick(MainActivity.java:27)
  04-09 15:05:37.453: E/AndroidRuntime(9980):     at android.view.View.performClick(View.java:4204)
  04-09 15:05:37.453: E/AndroidRuntime(9980):     at android.view.View$PerformClick.run(View.java:17355)
  04-09 15:05:37.453: E/AndroidRuntime(9980):     at android.os.Handler.handleCallback(Handler.java:725)
  04-09 15:05:37.453: E/AndroidRuntime(9980):     at android.os.Handler.dispatchMessage(Handler.java:92)
  04-09 15:05:37.453: E/AndroidRuntime(9980):     at android.os.Looper.loop(Looper.java:137)
  04-09 15:05:37.453: E/AndroidRuntime(9980):     at android.app.ActivityThread.main(ActivityThread.java:5041)
  04-09 15:05:37.453: E/AndroidRuntime(9980):     at java.lang.reflect.Method.invokeNative(Native Method)
  04-09 15:05:37.453: E/AndroidRuntime(9980):     at java.lang.reflect.Method.invoke(Method.java:511)
  04-09 15:05:37.453: E/AndroidRuntime(9980):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
  04-09 15:05:37.453: E/AndroidRuntime(9980):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
  04-09 15:05:37.453: E/AndroidRuntime(9980):     at dalvik.system.NativeStart.main(Native Method)
  </code></pre>