Android: use handler post.delayed twice
Why do you expect it to stop on postDelayed? postDelayed places your Runnable to the Handler Looper queue and returns. Since both handlers are created on the same looper, the second runnable is executed after the first one terminates (plus whatever left of the 500 ms delay)
UPDATE:
You need something like that
Handler handler = new Handler();handler.postDelayed(new Runnable() { @Override public void run() { btn1.setBackgroundColor(Color.GREEN); }}, 1000);handler.postDelayed(new Runnable() { @Override public void run() { btn1.setBackgroundResource(R.drawable.selector); }}, 2000);
new Handler().postDelayed(new Runnable() { @Override public void run() { //Your Work } }, 1000);