protected void onProgressUpdate(Integer... progress) { if (progress[0] == 25) { parentScreen.dismissDialog(UPGRADE_DB); setImageButtonToFragments(); completed = true; notifyActivityTaskCompleted(); } if (progress[0] == 50) { Logging.Log(LOG_TAG, "Finished fixing shows"); } if (progress[0] == 75) { String message = "Updated Artists"; Toast.makeText(HomeScreen.this, message, Toast.LENGTH_SHORT).show(); } }
// The parent could be null if you changed orientations // and this method was called before the new SearchScreen // could set itself as this Thread's parent. private void notifyActivityTaskCompleted() { if (parentScreen != null) { parentScreen.onTaskCompleted(); } }
protected void onPreExecute() { Logging.Log(LOG_TAG, "Starting UpgradeTask"); if (db.needsUpgrade) { parentScreen.showDialog(UPGRADE_DB); } }