我正在调试一个包含许多活动的多线程Android应用程序。在一个活动中,我需要显示一个AlertDialog。我不知道这项活动是否有效。我应该在AlertDialog的Builder方法中写什么?我写了以下内容:
new AlertDialog.Builder(getApplicationContext())
但是我的应用程序在此之后崩溃了。
更新: 崩溃并说
01-02 21:49:13.210: E/AndroidRuntime(23940): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
答案 0 :(得分:1)
new AlertDialog.Builder(YourActivity.this)