X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=src%2Fcom%2Fhughes%2Fandroid%2Fdictionary%2FDictionaryActivity.java;h=3062b7249a14e2c4f4ab31b6d98bcd76a37ef628;hb=3b4ed15ecaa3227aae17eceffe5e81285d328faf;hp=0b09e6da8855fdf4e151e5499b1cb2a0545b5ddd;hpb=83d9dc7cd871082a82c2dd0dbb7a0ceabd7c83a0;p=Dictionary.git diff --git a/src/com/hughes/android/dictionary/DictionaryActivity.java b/src/com/hughes/android/dictionary/DictionaryActivity.java index 0b09e6d..3062b72 100644 --- a/src/com/hughes/android/dictionary/DictionaryActivity.java +++ b/src/com/hughes/android/dictionary/DictionaryActivity.java @@ -238,8 +238,9 @@ public class DictionaryActivity extends AppCompatActivity { } dictRaf = null; } - Toast.makeText(this, getString(R.string.invalidDictionary, "", e.getMessage()), - Toast.LENGTH_LONG).show(); + if (!isFinishing()) + Toast.makeText(this, getString(R.string.invalidDictionary, "", e.getMessage()), + Toast.LENGTH_LONG).show(); startActivity(DictionaryManagerActivity.getLaunchIntent(getApplicationContext())); finish(); } @@ -413,7 +414,8 @@ public class DictionaryActivity extends AppCompatActivity { } if (dictFilename == null) { - Toast.makeText(this, getString(R.string.no_dict_file), Toast.LENGTH_LONG).show(); + if (!isFinishing()) + Toast.makeText(this, getString(R.string.no_dict_file), Toast.LENGTH_LONG).show(); startActivity(DictionaryManagerActivity.getLaunchIntent(getApplicationContext())); finish(); return; @@ -522,8 +524,9 @@ public class DictionaryActivity extends AppCompatActivity { typeface = Typeface.createFromAsset(getAssets(), fontName); } catch (Exception e) { Log.w(LOG, "Exception trying to use typeface, using default.", e); - Toast.makeText(this, getString(R.string.fontFailure, e.getLocalizedMessage()), - Toast.LENGTH_LONG).show(); + if (!isFinishing()) + Toast.makeText(this, getString(R.string.fontFailure, e.getLocalizedMessage()), + Toast.LENGTH_LONG).show(); } break; } @@ -1244,9 +1247,10 @@ public class DictionaryActivity extends AppCompatActivity { out.close(); } catch (Exception e) { Log.e(LOG, "Unable to append to " + wordList.getAbsolutePath(), e); - Toast.makeText(this, - getString(R.string.failedAddingToWordList, wordList.getAbsolutePath()), - Toast.LENGTH_LONG).show(); + if (!isFinishing()) + Toast.makeText(this, + getString(R.string.failedAddingToWordList, wordList.getAbsolutePath()), + Toast.LENGTH_LONG).show(); } }