-
[ERROR] Can't toast on a thread that has not called Looper.prepare()Android📱 2022. 3. 25. 19:45
Can't toast on a thread that has not called Looper.prepare()
Ui스레드가 아닌 다른 스레드에서 토스트 메세지를 띄우려할때 나는 에러라고 한다.
Handler handler = new Handler(Looper.getMainLooper()); handler.postDelayed(new Runnable() { @Override public void run() { // 토스트 창을 띄울 코드를 여기에 적어주자 : ) } }, 0);
핸들러로 감싸줘야 가능
'Android📱' 카테고리의 다른 글
[안드로이드] Back Stack??? (0) 2022.03.28 [안드로이드] Context (0) 2022.03.28 [Android] Custom View와 Activity의 좌표가 다른 문제 (0) 2022.03.18 [안드로이드 오류] Cannot resolve symbol (0) 2022.03.12 [Adroid] Live Data 실험해보기 (0) 2022.03.09