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

前端 未结 6 1725
我寻月下人不归
我寻月下人不归 2020-12-03 16:50

I get this error \"Can\'t create handler inside thread that has not called Looper.prepare()\"

Can you tell me how to fix it?

public class PaymentAc         


        
6条回答
  •  伪装坚强ぢ
    2020-12-03 17:35

    Try

    final Handler handlerTimer = new Handler(Looper.getMainLooper());
            handlerTimer.postDelayed(new Runnable() {
                public void run() {
                                    ...... 
    
                                  }
                                                     }, time_interval});
    

提交回复
热议问题