Android [Unable to add window, token null is not valid. is your activity running?]

Posted Leave a commentPosted in 안드로이드

AlertDialog 를 생성할 때 getApplicationContext()를 사용하면 에러가 납니다. 이때는[Activity이름].this 로 변경하면 해결됩니다. 다음은 예시입니다. AlertDialog.Builder b = new AlertDialog.Builder(ConfigDeviceTypeChoiceActivity.this); b.setTitle(“등록 성공”); b.setMessage(“성공적으로 등록하였습니다.”); final AlertDialog alert = b.create(); alert.show();