Android : Android, I Cant update the image src for untill another thread is sleeping 600 milis

on Saturday, August 2, 2014


I want to give the sensation that a button was pressed by the system. the two images are used when the user press and I want to create the same effect using a thread sleep between both images


But the system doesnt update the button src as expected. Resumming I want to chaneg the src, wait 600 milisec and update again


Can someone give me a direction on it?



switch (color) {
case 1: //green
// first image
Main.imageButtonGreen.setImageResource(R.drawable.light_green);

//this is just to make it sleep to give the sensation that the button was pressed
try {
Blink blink = new Blink();
Thread t = new Thread(blink);
t.run();
t=null;
}
catch (Exception e){if (Main.debug) Log.d("Blink.blink Switch color= ", e.getMessage());}
//scond image
Main.imageButtonGreen.setImageResource(R.drawable.dark_green);
break;

0 comments:

Post a Comment