I have been looking for an answer for this for some time. I have an async task that loads the database needed for my application, while this loading my application cannot do anything, since all the data it refers to is in this file, I have an application waiting file download, but I'm trying to show a progress dialog so that the user knows that something is happening while they wait for it 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 appears, I also tried to directly call ProgressDialog.show in pre execute and move it to the calling activity without any luck.
Please, help!
android android-asynctask progress-bar
Philderbeast
source share