title: handler.postDelayed() is not executing
body: <p>So my problem is I can't get my handler to post after a certain amount of time. For some reason, it causes every button in the program to bug out and flash both of the colours. I'm open to suggestion and I am willing to switch up the code if something works better than handler. However, I would like to avoid using AsyncTask because I have no idea as to how to use it and it generally just pisses me off. Though I am willing to use it if absolutely necessary.</p>
  
  <pre><code>@Override
  public void run() {
      random = new Random();
      random2 = new Random();
  
      try{
          Thread.sleep(1000);
          while(running){
              ran = random.nextInt(9);
              type = random2.nextInt(3);
  
              if(lives &gt; 0){
                  if((type == 0 || type == 2)){
                      runOnUiThread(new Runnable() {
                          @Override
                          public void run() {
                              buttons[ran].setImageResource(R.drawable.button_red);
                              buttons[ran].setTag("Red");
  
                          }
                      });
                      handler.postDelayed(new Runnable() {
                          @Override
                          public void run() {
                              if(buttons[ran].getTag().equals("Red")){
                                  buttons[ran].setTag("Black");
                                  buttons[ran].setImageResource(R.drawable.button_null);
                                  lifeLost();
                              }
                          }
                      }, 1000);
                  }else{
                      runOnUiThread(new Runnable() {
                          @Override
                          public void run() {
                              buttons[ran].setImageResource(R.drawable.button_white);
                              buttons[ran].setTag("White");
  
  
                          }
                      });
  
                      handler.postDelayed(new Runnable() {
                          @Override
                          public void run() {
                              if(buttons[ran].getTag().equals("White")){
                                  buttons[ran].setTag("Black");
                                  buttons[ran].setImageResource(R.drawable.button_null);
                              }
                          }
                      }, 1000);
                  }
                  if(score == 10){
                      duration -= 50;
                  }else if(score == 20){
                      duration -= 50;
                  }else if(score == 30){
                      duration -= 40;
                  }else if(score == 40){
                      duration -= 15;
                  }
              }else{
                  runOnUiThread(new Runnable() {
                      @Override
                      public void run() {
                          finished.setVisibility(View.VISIBLE);
                      }
                  });
                  try{
                      Thread.sleep(1000);
                      Intent overIntent = new Intent(this, OverActivity.class);
                      overIntent.putExtra("point", score);
                      startActivity(overIntent);
                      overridePendingTransition(0, 0);
                  }catch (Exception e){}
              }
          }
      }catch(Exception e){
          e.printStackTrace();
      }
  }
  </code></pre>