How can I implement a progress bar that will show the progress download of all files in percentage from 0% to 100% (all files). This is how my async looks like:
public class DownloadFileFromFTP extends AsyncTask<String, Void, String> {
private Context context;
private ProgressDialog progressDialog;
public DownloadFileFromFTP(Context context) {
this.context = context;
this.progressDialog = new ProgressDialog(MyActivity.this);
this.progressDialog.setCancelable(false);
this.progressDialog.setMessage("Please wait...");
this.progressDialog.show();
}
protected void onPreExecute() {
}
@Override
protected String doInBackground(String... arg0) {
//code to list ftp files
return null;
}
@Override
protected void onProgressUpdate(Void... values) {
super.onProgressUpdate(values);
}
@Override
protected void onPostExecute(String result) {
if (this.progressDialog != null) {
this.progressDialog.dismiss();
}
}
}