title: In android Why my ProgressBar Freezes?
body: <p>i am showing Progress Bar at time of retrieving data from server and after retrieving data from server showing that data on chart but at time of plotting that data on chart my progress bar get freezes does any one have idea why this is so......</p>
  
  <p>THANKS in advance...</p>
  
  <pre><code>private ProgressDialog pd;
  private Handler handler = new Handler() {
      @Override
      public void handleMessage(Message msg) {        
          Toast.makeText(context, "Please Wait...", Toast.LENGTH_LONG).show();
          Thread t = new Thread(new Runnable() {              
              @Override
              public void run() {
                  functionDrawMyData();/*in this function i am accessing activity view and drawing data on that view at time of drawing my Progress bar Freezes */
              }
          });
          runOnUiThread(t);
          pd.dismiss();           
      }
  };  
  </code></pre>
  
  <p>this handler i am using which is called after retrieving data finished
  and on button click i am getting data and showing progress bar</p>
  
  <pre><code>ImageButton myButton = (ImageButton) findViewById(R.id.myBtn);
  pair1ChartButton.setOnClickListener(new OnClickListener() {
          @Override
          public void onClick(View v) {               
                  pd = ProgressDialog.show(v.getContext(),"Please wait...","Retrieving data ...",true,
                          true,
                          new DialogInterface.OnCancelListener(){
                              @Override
                              public void onCancel(DialogInterface dialog) {
  
                              }
                          });
                  Thread t = new Thread(new Runnable() {                      
                      @Override
                      public void run() {
                              getDataFromServer();//calling function to get data from server
                          handler.sendEmptyMessage(0);                    
                      }
                  });
                  t.start();
          }
      });
  </code></pre>