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

Looper.prepare(); 
//开头

Builder builder = new Builder(MyBurglarService.this); 
//这里我的MyBurglarService是我的一个线程

            /*在这设置builder的属性*/

AlerDialog dialog = builder.create();
//属性设置完后创建

dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); 
//设置该dialog为全局性的对话框,即在任何时候都弹出的对话框

dialog.show(); 
//弹出

Looper.loop(); 
//结尾


线程开头加个Looper.prepare();

线程结束加个Looper.loop();

你可能感兴趣的:(thread,android,service,dialog,服务)