首页 > 代码库 > Android handler 报错处理Can't create handler inside thread that has not called Looper.prepare()

Android handler 报错处理Can't create handler inside thread that has not called Looper.prepare()

解决方法,在ui线程里面创建handler

m_MainActivity.runOnUiThread(new Runnable(){

            @Override
            public void run() {
                // TODO Auto-generated method stub
                GameBoxUtil.startPay(m_MainActivity,String.valueOf(amount), productName, payCode,orderId,payHandler);
            }}); 

 

Android handler 报错处理Can't create handler inside thread that has not called Looper.prepare()