개발하다보면 Dialog를 띄울때가 있다.
근데 is your activity running? 이러면서 안될때가 있는데
이때 문제는 getApplicationContext() 나 this를 써서 그렇다.
이걸 MainActivity.this를 쓰면 Dialog가 잘 뜬다.
XXDialog dialog = new XXDialog(MainActivity.this);
dialog.show();
[ Android / Kotlin ] AlertDialog 오류 : Unable to add window -- token null is not valid; is your activity running?
AlertDialog를 사용하며 android.view.WindowManager$BadTokenException:Unable to add window -- token null is not valid; is your activity running? 이런 오류를 겪었습니다. 당연하게도 갓구글..
gyubgyub.tistory.com
참고자료
'Android > Technic' 카테고리의 다른 글
Android webview lazy loading 시 느릴때 고려점 (0) | 2021.06.01 |
---|---|
Android webview debugger 사용하기 (2) | 2021.05.21 |
안드로이드에서 Video 로딩 시 이상한 그림(Poster) 안 뜨게 하는 방법 (0) | 2021.05.21 |
Javascript Interface 사용 방법 (4) | 2021.05.07 |
Bottom Navigation View에서 애니메이션 없애기 (0) | 2021.05.03 |
댓글