title: Android how to runOnUiThread in other class?
body: <p>In my application, in MainActivity, there is a thread which works fine.  But when I call another class to get data from the server I can't run on a thread.  See code example below.</p>
  
  <pre><code>class MainActivity extends Activity implements Runnable {
  
      public void onCreate() {
          new Thread(this).start();
      }
  
      public void run() {
          //here is code for download data from server after completion this and in handler  i m call other class in setdata() method....
      }
  
      public void setData() {
          new CheckData(this);
      }
  }
  
  class CheckData {
      public CheckData(Context context) {
          context.runUIonthread(){//cant call as runUIthread............
      }
  }
  </code></pre>