1
更改背景我有每30秒更換背景圖片,但我沒有得到正確的結果在特定的時間間隔
我試圖與線程和TimerTask。但沒有工作。 我有port1,port2 ...等圖像。
在TimerTask背景消失了。
class Task1 extends TimerTask {
public void run() {
System.out.println("Checking a");
Random r = new Random();
int i = r.nextInt(3) + 1;
rl.setBackgroundResource(getResources().getIdentifier(
"port" + i, "drawable","com.samcom.breakingdowncd"));
}
}
Timer timerBackground = new Timer();
timerBackground.scheduleAtFixedRate(new Task1(), 0, 30000);
它不工作,任何幫助將不勝感激。 感謝
沒有用嗎? – George 2011-05-29 12:56:30
是的,謝謝你的幫助。它的工作 – djk 2011-05-30 11:45:01
不錯的教程.....真棒 – 2011-10-19 04:26:25