new Thread(new Runnable(){
@Override
public void run(){
int count = 0;
while (true)
{
count++;
Log.e("Demo","count="+count);
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}).start();
总结要点:
1、安卓内延迟只能用多线程实现
2、sleep外必须用try包裹