0

I am debugging a multithreading android app with many activities. In one activity I need to show an AlertDialog. I don't know if this activity is active or not. What should I write in the Builder method of AlertDialog? I have written the following:

new AlertDialog.Builder(getApplicationContext())

but my app crashes after this.

UPDATE: crashes and says

01-02 21:49:13.210: E/AndroidRuntime(23940): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
user881259
  • 163
  • 1
  • 3
  • 10
  • crashes and says WHAT? And why haven't you put here the line on which it is crushing? – Gangnus Dec 28 '11 at 19:41
  • You're going to have to post more of your code and paste the output from the log cat that happens when your application crashes. – FoamyGuy Dec 28 '11 at 19:43
  • Possible duplicate - http://stackoverflow.com/questions/1561803/android-progressdialog-show-crashes-with-getapplicationcontext – Jason Robinson Dec 28 '11 at 20:19

1 Answers1

1
new AlertDialog.Builder(YourActivity.this)
Alexander Kulyakhtin
  • 47,782
  • 38
  • 107
  • 158