@Override
  protected void onPostExecute(Boolean result) {
    super.onPostExecute(result);

    try {
      indeterminateDialog.dismiss();
    } catch (IllegalArgumentException e) {
      // Catch "View not attached to window manager" error, and continue
    }

    if (result) {
      // Restart recognition
      activity.resumeOCR();
      activity.showLanguageName();
    } else {
      activity.showErrorMessage(
          "Error",
          "Network is unreachable - cannot download language data. "
              + "Please enable network access and restart this app.");
    }
  }