@Override
  protected void applyResults(Void result, Exception backgroundException) {
    if (mDictionary != null) {
      mDictionary.close();
    }

    UserDictionaryEditorFragment activity = getOwner();

    try {
      if (backgroundException != null) {
        Toast.makeText(
                mAppContext,
                mAppContext.getString(
                    R.string.user_dict_restore_fail_text_with_error,
                    backgroundException.getMessage()),
                Toast.LENGTH_LONG)
            .show();
        if (activity != null) activity.showDialog(UserDictionaryEditorFragment.DIALOG_LOAD_FAILED);
      } else {
        if (activity != null) activity.showDialog(UserDictionaryEditorFragment.DIALOG_LOAD_SUCCESS);
      }
      // re-reading words (this is a simple way to re-sync the
      // dictionary members)
      if (activity != null) activity.fillLanguagesSpinner();
    } catch (BadTokenException e) {
      // activity gone away!
      // never mind
    }
  }
 RestoreUserWordsAsyncTask(UserDictionaryEditorFragment callingFragment, String filename) {
   super(callingFragment, true);
   mAppContext = callingFragment.getActivity().getApplicationContext();
   mFilename = filename;
 }