Android

error: Can't create handler inside thread that has not called Looper.prepare()

캡틴노랑이 2019. 9. 28. 20:17
반응형

Tread를 사용하다 보면 다음과 같은 오류가 발생함.

 

Can't create handler inside thread that has not called Looper.prepare()

 

이때 아래 코드를 사용하면 됨.

 

참조해야될 라이브러리

import android.os.Handler;
import android.os.Looper;

 

Timer에서의 사용 예

참고 사이트

https://altongmon.tistory.com/7
https://stackoverflow.com/questions/11359930/android-cant-create-handler-inside-thread-that-has-not-called-looper-prepare

 

반응형