1) You must first create a class for asyncTask, and you must establish a connection to the remote server in the doInBackground () method
2) you must make an arrayAdapter from the remoteServer response, this also needs to be done in the doInBackground () method
3) after successful installation of the adapter in AutoCompleteTextView
new AsyncTask<Integer, Void, arrayList> () {
ProgressDialog progressDialog;
@Override
protected void onPreExecute() {
progressDialog = ProgressDialog.show(context, "downloading...", "Please wait...");
super.onPreExecute();
}
@Override
protected void onPostExecute(arrayList result) {
progressDialog.dismiss();
super.onPostExecute(result);
}
@Override
protected arrayList doInBackground(Integer... params) {
return arrayList
}
}.execute(1);
source
share