【发布时间】:2018-03-12 12:07:19
【问题描述】:
我需要在 10 秒后将图像从红色切换为黄色,然后在单击按钮 3 秒后将其切换为绿色。
图像是“可绘制的”,三个图像存储在 imgesView1 数组中。
图像应该在 threadSleep 10 秒后将其状态更改为黄色,但是当与服务器的所有通信结束时,它会更改为黄色之后的绿色状态。
这是我的代码。
new SendCommandRequest().execute(parameterForURL);
try{Thread.sleep(10000);}
catch (InterruptedException ie){}
imageView1.setImageResource(images1[1]);
switch(result1) {
case "1":
new SendCommandRequest().execute(parameterForURL);
imageView1.setImageResource(images1[1]);
try{Thread.sleep(3000);}
catch (InterruptedException ie){}
imageView1.setImageResource(images1[1]);
只需单击一次按钮即可完成所有任务。
【问题讨论】: