I am using separate thread to get the json object from the url. but the problem is I would like to show the progress dialog while getting the result. I have create a progress di
You can do it using AsyncTask..by adding the thread part into the doInBackground method..show the progress dialog in onPreExecute and dismiss it in onPostExecute..
ex:
public class MyTask extends AsyncTask {
private Context context;
private ProgressDialog progressDialog;
public MyTask (Context context) {
this.context = context;
}
@Override
protected void onPreExecute() {
progressDialog = ProgressDialog.show(context, "", "Loading...", true);
}
/*
* @see android.os.AsyncTask#doInBackground(Params[])
*/
@Override
protected String doInBackground(String... arg0) {
//your json thread part
}
@Override
protected void onPostExecute(final String result) {
progressDialog.dismiss();
}
}