내가 메소드를 호출하고 호출Looper.Loop() 예외가 내부 방법
public static void errorAction(String data){
ProgressDialog dialog = new ProgressDialog(context);
dialog.setTitle("hi");
dialog.setMessage("there");
dialog.show();
}
나는 다음과 같은 예외가 얻을 그러나 :
Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
을 dialog.show()
부분.
실제로 새 스레드에서 호출이 발생했기 때문입니까? 그렇다면 UI 스레드에서 실행하는 방법은 무엇입니까? 어떻게 대화 상자를 보여줄 수 있을까요?
감사합니다!
당신이 말한 것처럼 다른 스레드에서 호출이 발생하기 때문에이 답변이 도움이 될 수 있습니다 : [Looper.prepare()를 호출하지 않은 스레드에서 처리기를 만들 수 없습니다] (http://stackoverflow.com/ a/3875204/4368623) – Nahue