I have a list in my app that is populated via a http request to our database API. Then it parses the JSONArray that is returned, and sets the list appropriately. By the way I am quite new to Java coding and the eclipse environment.
I have achieved the http request with the custom library developed by loopj (located here)
However, when I go to the list in my app, it freezes for a second or two (while it collects the data) and then populates this list and everything works fine. Is it possible to implement a loader that will display until the list has completed loading with the current AsyncHttpClient I am using? Or do I need to change to a different one. I can't provide any code due to contractual agreements.
Thanks for any suggestions!
I do something like this in my Async class
public class Async extends AsyncTask {
private ProgressDialog dialog;
public Context applicationContext;
@Override
protected void onPreExecute() {
//this should appear like a loading bar
this.dialog = ProgressDialog.show(applicationContext, "Calling",
"Update List ...", true);
}
@Override
protected Object doInBackground(Object... params) {
//call your method and threat response
return SyncActivity.getUpdatedList();
}
@Override
protected void onPostExecute(Object result) {
this.dialog.cancel();
}
}