This code runs on a background Thread:
@Override
public void run() {
while (true) {
a = a+1;
try {
Thread.sleep(100);
}
catch (Throwable t) {
Log.e("","", t);
}
}
}
In developer console I see ANR report:
ANR Input dispatching timed out (Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago.)
"myThread" prio=5 tid=7 SUSPENDED
| group="main" sCount=1 dsCount=0 obj=0x11111111 self=0x22222222
| sysTid=11111 nice=0 sched=0/0 cgrp=[fopen-error:2] handle=333333333
| state=S schedstat=( 0 0 0 ) utm=2 stm=3 core=1
at java.lang.VMThread.sleep (Native Method)
at java.lang.Thread.sleep (Thread.java:1013)
at java.lang.Thread.sleep (Thread.java:995)
at com.example.MyThread.run (MyThread.java:123)
How can I fix this ANR?