Why does AlertDialog.Builder(Context context) only accepts Activity as a parameter?
问题 In my ongoing learning process (dialog boxes this time), I discovered that this works: AlertDialog.Builder builder = new AlertDialog.Builder(this); While the following doesn\'t work (fails at runtime with WindowManager$BadTokenException): AlertDialog.Builder builder = new AlertDialog.Builder(this.getApplicationContext()); I don\'t understand why, because the constructor for AlertDialog.Builder is defined to accept Context as a parameter, not Activity: public AlertDialog.Builder (Context