title: ProgressDialog working in thread on android
body: <p>I have a little problem, I hope U can help me;)</p>
  
  <p>Trouble is, that ProgressDialog show only after loading run(), but I need to show it on start and showing it while loading some data. I put: "dialog = ProgressDialog.show(CategoriesListActivity.this,"Working...","Loading data", true);" in method run(), but the same. I print in Log.i() some info (int i++) and put title of ProgressDialog. Method work correctly, but don't show ProgressDialog. I have read some info that some thread block another thread (my created), that's why doesn't show progressDialog, but can't do anything. Thx.</p>
  
  <pre><code>    public void run() {
  
          /** getting there long execution **/
          handler.sendEmptyMessage(0);
  
      }
  
      private Handler handler = new Handler() {
          @Override
          public void handleMessage(Message msg) {
  
              // stop and hide dialog
              dialog.dismiss();
          }
      };
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.list_
  
          dialog = ProgressDialog.show(CategoriesListActivity.this, "Working...",
                  "Loading data", true);
  
          // start new thread where get long time execution
          Thread thread = new Thread(this);
          thread.start();
  
          //wait while data is loading, 'cause I need use variable from calculation
                  // in "EfficientAdapter" later
          try {
              thread.join();
          } catch (InterruptedException e) {
              e.printStackTrace();
          }
  
          ListView l1 = (ListView) findViewById(R.id.list);
          l1.setAdapter(new EfficientAdapter(this));
      }
  </code></pre>