Progress dialog problem
<p>Actually i have a problen while using progress dialog.The problem is not with the progress dialog.What i find difficult is.</p>

<p>I call a function onPause() of an activty say </p>

<pre><code>public void onPause()
{
   super.onPause();
   setData();
}
</code></pre>

<p>Now onBackpressed() method i display an progressdialog, and the code i have use is</p>

<pre><code>public void onBackPressed() 
{           
    final ProgressDialog progressDialog = ProgressDialog.show(this, "", "Loading. Please wait...", true);
    Thread reminderThread = new Thread() 
    {
        public void run()
        {
            try
            {
                Thread.sleep(3 * 1000);
                ReminderForm.this.finish();
                progressDialog.dismiss();                           
            } 
            catch (InterruptedException e)
            {
                e.printStackTrace();
            }
        }
    };reminderThread.start();
 }
</code></pre>

<p>Now my problem is that when i enter Data and call setData() on the onPause() method it takes times to exit from at that activity.So during that time i display the progress bar when the user click back button.so these work fine but when the user enter no data then i want the progress bar to show but with less time as shown when the user enter data and call the setData() method of onPause() method.But in my case whether the user enter data or not the progressBar will take 3 sec.So is there any way where i can get the time of first thread and put that time in my second thread.</p>
