I need to toggle a image from red to yellow after 10 second and to green 3 seconds after clicking a button.
Images are "drawable" with three image stored into imgesView1 array.
The image is supposed to change its state into yellow after threadSleep 10 second and but when all communication is over with the server it changes to green state which is to come after yellow.
Here is my code.
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]);
All tasks are done on a single button click.