How to display progress dialog before starting an activity in Android?

You should load data in an AsyncTask and update your interface when the data finishes loading. You could even start a new activity in your AsyncTask’s onPostExecute() method. More specifically, you will need a new class that extends AsyncTask: public class MyTask extends AsyncTask<Void, Void, Void> { public MyTask(ProgressDialog progress) { this.progress = progress; } … Read more

Passing arguments to AsyncTask, and returning results

Change your method to look like this: String curloc = current.toString(); String itemdesc = item.mDescription; ArrayList<String> passing = new ArrayList<String>(); passing.add(itemdesc); passing.add(curloc); new calc_stanica().execute(passing); //no need to pass in result list And change your async task implementation public class calc_stanica extends AsyncTask<ArrayList<String>, Void, ArrayList<String>> { ProgressDialog dialog; @Override protected void onPreExecute() { dialog = new … Read more

tech