title: synchronized in android
body: <p>I have two processes "Loaddata(); Workoffline();", now I want the process Loaddata(); to run until it is completed, the application can switch to the next process Workoffline(); .But I do not know how to do, expect people to help me.</p>
  
  <pre><code>public void test(){    
              runOnUiThread(new Runnable() {
  
                  @Override
                  public synchronized void run() {
  
                      loaddata();
                      //your UI interaction code here
  
                  }
              });
              runOnUiThread(new Runnable() {
  
                  @Override
                  public void run() {
                      // TODO Auto-generated method stub
                      workoffline();
                  }
              });
  }
  </code></pre>