I am trying to create downloading progress. I have my class which extends AsyncTask:
public class DownloadFileTask extends AsyncTask
When downloading starts i want to create progress:
@Override
protected void onPreExecute() {
progressDialog = new ProgressDialog(whatContext);
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.setMessage("Loading...");
progressDialog.setCancelable(false);
progressDialog.show();
}
But i don’t know what context i should give to new ProgressDialog becouse i am not in Activity class. I tried to give some context but there an error:
No enclosing instance of the type Main_Tab is accessible in
scope
So how i could create this progress ?
Also i wanted to create progress not in this class (becouse i want seperate functions and design), but i did’t figure out how to do that.
Thank you guys for help.
To start DownloadTask call like