Using of Toast with thread in android
<pre><code>progressDialog = ProgressDialog.show(GetResponse.this, "", "Loading...");

new Thread() 
        {
            public void run() 
            {
                try
                {
// inside i have written code for making connection to the server using SSL connection.
}catch (Exception e)

  {     
            progressDialog.dismiss();     
             exception(e.getMessage())
                  }.start(); 
 }
 private void exception(String msg) 
 {
  Toast.makeText(this, msg, Toast.LENGTH_LONG).show();
  this.finish();
  Intent i = new Intent(getBaseContext(), LoginPage.class);
  startActivity(i);

 }
</code></pre>

<p>my LoginPage.java is previous activity.
If the connection is successfull it goes to the next activity ot doesnt give any error,
But if der is any prob with connection then i want progress bar should be stopped and go back to the LoginPage activity and also i want the error msg to be displayed.
From the above im getting some error.. Please help me out on this</p>
