title: android set visibility of a button on timer
body: <p>I have an app that shows a disclaimer at the beginning of the program. I want a button to remain invisible for a set amount of time, and then become visible.
  I set up a thread that sleeps for 5 seconds, and then tries to make the button visible. However ,I get this error when I execute my code:</p>
  
  <p>08-02 21:34:07.868: ERROR/AndroidRuntime(1401): android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.</p>
  
  <p>How can I count 5 seconds, and then make the button visible?
  THanks.</p>
  
  <pre><code>Thread splashTread = new Thread() {
             @Override
             public void run() {
              try {
                     int waited = 0;
                     while(_active &amp;&amp; (!_ok2)) {
                         sleep(100);
                         if(_active) {
                             waited += 100;
                             if(waited &gt;= _splashTime)
                             {
                              turnButtonOn();
                             }
  
                         }
                     }
                 } catch(InterruptedException e) {
                     // do nothing
                 } finally {
                     finish();
                     startActivity(new Intent("com.lba.mixer.Choose"));
  
                 }
      };
      splashTread.start();
  
  
        public static void turnButtonOn() {
           okButton.setVisibility(View.VISIBLE);
        }
  </code></pre>