title: android Progress bar dismissed early
body: <p>my code:</p>
  
  <pre><code>OnClickListener()//onclicklistener for button
  {
      ProgressBar = new ProgressDialog(LoginPageActivity.this);
      ProgressBar.setMessage("please wait..");     
      ProgressBar.show();
  
      TcpConnection loginConnect = new TcpConnection();//TcpConnection is a class
      loginConnect.run();
      ProgressBar.dismiss();
  }
  </code></pre>
  
  <p>i tried to show progress dialog before calling another class and dismiss it after the call is over. but progressbar will not showing and it dismissed early . but i want to show progress bar for certain period of time.</p>
  
  <p>Inside tcp connection class: having socket connection for user name password thats y i need to display progress for certain period of time</p>
  
  <p>i dont know how to do it!</p>