I have been searching for an answer for this for some time now. I have an async task that downloads the database needed for my app, while this is downloading my app cant do anything as all the data it references is in this file, i have the app waiting for the file to be downloaded but i am attempting to show a progress dialog so the user knows something is happening while they wait for this to happen.
my code is currently
public class fileDownloader extends AsyncTask<Void, Integer, SQLiteDatabase>
{
private File dbFile;
private ProgressDialog progressDialog;
private Context context;
private SQLiteDatabase database;
private SQLiteDatabase.CursorFactory factory;
public fileDownloader(Context c)
{
super();
context = c;
}
@Override
protected void onPreExecute()
{
super.onPreExecute();
progressDialog = new ProgressDialog(this.context);
progressDialog.setMessage("Downloading Database...");
progressDialog.setCancelable(false);
progressDialog.setIndeterminate(true);
progressDialog.show();
}
@Override
protected SQLiteDatabase doInBackground(Void... v)
{
....
}
@Override
protected void onPostExecute(SQLiteDatabase db1)
{
progressDialog.dismiss();
}
however nothing shows up i have also tried directly calling ProgressDialog.show in the pre execute and moving this to the calling activity with no luck.
please help!