你好我试图使用线程来使拍摄系统工作 为了工作有一个按钮用于空间攻击,他可以每20秒使用 我试图follwing代码这样做:使用一个线程等待20秒,然后再做动作java android
ballatack.setImageResource(R.drawable.buttonof);
Thread timer2 = new Thread(){
public void run(){
try{
sleep(5000);
}catch(InterruptedException e){
e.printStackTrace();
}finally{
ballatack.setImageResource(R.drawable.buttonof);
}
}
};
timer2.start();
,但它不工作,日食说完全不像verythings是正确的,但是当我运行模拟器它不工作
定义'它不work' ...我想你要连接到其他线程运行UI的东西例外... – Selvin
试试'的Thread.sleep(5000)' –