延迟从Oppo F1中的Handler的postDelayed()结束后,Runnable未完全执行

时间:2018-07-20 05:04:25

标签: android kotlin runnable android-handler

在oppo f1 5.1版中运行应用程序时,logcat显示以下错误:

ANR_LOG: >>> msg's executing time is too long 

Blocked msg = { when=-15s421ms what=0 target=android.view.Choreographer$FrameHandler callback=android.view.Choreographer$FrameDisplayEventReceiver } , cost  = 15162 ms
 >>>Current msg List is:
    Current msg <1>  = { when=-15s412ms what=0 target=android.os.Handler callback=android.support.v4.content.res.ResourcesCompat$FontCallback$2 }
    Current msg <2>  = { when=-15s410ms what=0 target=android.os.Handler callback=android.support.v4.content.res.ResourcesCompat$FontCallback$2 }
    Current msg <3>  = { when=-15s408ms what=0 target=android.os.Handler callback=android.support.v4.content.res.ResourcesCompat$FontCallback$2 }
    Current msg <4>  = { when=-15s405ms what=0 target=android.os.Handler callback=android.support.v4.content.res.ResourcesCompat$FontCallback$2 }
    Current msg <5>  = { when=-15s403ms what=0 target=android.os.Handler callback=android.support.v4.content.res.ResourcesCompat$FontCallback$2 }
    Current msg <6>  = { when=-15s400ms what=0 target=android.os.Handler callback=android.support.v4.content.res.ResourcesCompat$FontCallback$2 }
    Current msg <7>  = { when=-15s398ms what=0 target=android.os.Handler callback=android.support.v4.content.res.ResourcesCompat$FontCallback$2 }
    Current msg <8>  = { when=-15s395ms what=0 target=android.os.Handler callback=android.support.v4.content.res.ResourcesCompat$FontCallback$2 }
    Current msg <9>  = { when=-15s393ms what=0 target=android.os.Handler callback=android.support.v4.content.res.ResourcesCompat$FontCallback$2 }
    Current msg <10>  = { when=-15s386ms what=0 target=android.os.Handler callback=android.support.v4.content.res.ResourcesCompat$FontCallback$2 }
    Current msg <11>  = { when=-15s383ms what=0 target=android.os.Handler callback=android.support.v4.content.res.ResourcesCompat$FontCallback$2 }
    Current msg <12>  = { when=-15s377ms what=0 target=android.os.Handler callback=android.support.v4.content.res.ResourcesCompat$FontCallback$2 }
    Current msg <13>  = { when=-15s374ms what=0 target=android.os.Handler callback=android.support.v4.content.res.ResourcesCompat$FontCallback$2 }
    Current msg <14>  = { when=-15s367ms what=0 target=android.os.Handler callback=android.support.v4.content.res.ResourcesCompat$FontCallback$2 }
    Current msg <15>  = { when=-15s359ms what=0 target=android.os.Handler callback=android.support.v4.content.res.ResourcesCompat$FontCallback$2 }
    Current msg <16>  = { when=-15s350ms what=0 target=android.os.Handler callback=android.support.v4.content.res.ResourcesCompat$FontCallback$2 }
    Current msg <17>  = { when=-15s346ms what=0 target=android.os.Handler callback=android.support.v4.content.res.ResourcesCompat$FontCallback$2 }
    Current msg <18>  = { when=-15s339ms what=0 target=android.os.Handler callback=android.support.v4.content.res.ResourcesCompat$FontCallback$2 }
    Current msg <19>  = { when=-15s336ms what=0 target=android.os.Handler callback=android.support.v4.content.res.ResourcesCompat$FontCallback$2 }
    Current msg <20>  = { when=-15s333ms what=0 target=android.os.Handler callback=android.support.v4.content.res.ResourcesCompat$FontCallback$2 }
    >>>CURRENT MSG DUMP OVER<<<
07-19 16:36:51.656 12279-12279/com.symphonyfintech.xts E/ANR_LOG: >>> msg's executing time is too long
    Blocked msg = { when=-4s18ms what=0 target=android.view.Choreographer$FrameHandler callback=android.view.Choreographer$FrameDisplayEventReceiver } , cost  = 3789 ms
    >>>Current msg List is:
    Current msg <1>  = { when=-3s315ms what=0 target=android.widget.Editor$Blink callback=android.widget.Editor$Blink }
    >>>CURRENT MSG DUMP OVER<<<

1 个答案:

答案 0 :(得分:0)

  

在应用程序的主循环程序中使用处理程序。


作为参考,请在下面找到代码片段:

=