Reputation: 82
I am using Progress Bar that only shows up at the time of loading data using Volley but my progress bar freezes till the data loads. Please help. Below is the code that is working fine except the progress bar freezes.
private class GetValue extends AsyncTask<String, String, String> {
ProgressDialog progressDialog=null;
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog = ProgressDialog.show(context, "Loading Data...", "Please Wait");
}
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
progressDialog.dismiss();
}
@Override
protected String doInBackground(String... params) {
// TODO Auto-generated method stub
assignValues(mnyr ,mnyr1);
return null;
}
}
private void assignValues(String s1, String s2) {
// TODO Auto-generated method stub
//C.progressStart(context, "Loading Data...", "Please Wait");
final String s = s1;
final List<List<String>> values = new ArrayList<List<String>>();
datas = new ArrayList<CustomData>();
RequestQueue queue = Volley.newRequestQueue(this);
String val = s1 + "/" + s2;
final StringRequest request = new StringRequest(Method.GET, C.EVENTS + val,
new Listener<String>() {
@Override
public void onResponse(String arg0) {
// TODO Auto-generated method stub
JsonParser parent = new JsonParser(arg0);
if(parent.getValue("data") == null){
int length = parent.getArrLength(arg0);
Upvotes: 0
Views: 1883
Reputation: 11194
ProgressDialog progressDialog=null; // inside asynTask method
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog = ProgressDialog.show(uractivity.this, "Wait", "Downloading...");
}
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
progressDialog.dismiss();
}
Upvotes: 1