X-Git-Url: http://gitweb.fperrin.net/?p=Dictionary.git;a=blobdiff_plain;f=src%2Fcom%2Fhughes%2Fandroid%2Fdictionary%2FDictionaryActivity.java;h=0637f165ff275410e30c3b8f365fced678ee3291;hp=b9b5043d21694261456efaa313080963633747ef;hb=3ce0dd16e69302365d3bc802f298a5388b293d86;hpb=a01621630defba5e96e4a15764b6609087a4d9aa diff --git a/src/com/hughes/android/dictionary/DictionaryActivity.java b/src/com/hughes/android/dictionary/DictionaryActivity.java index b9b5043..0637f16 100644 --- a/src/com/hughes/android/dictionary/DictionaryActivity.java +++ b/src/com/hughes/android/dictionary/DictionaryActivity.java @@ -1285,7 +1285,7 @@ public class DictionaryActivity extends AppCompatActivity { Log.d(LOG, "Trying to hide soft keyboard."); final InputMethodManager inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); View focus = getCurrentFocus(); - if (focus != null) { + if (inputManager != null && focus != null) { inputManager.hideSoftInputFromWindow(focus.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } @@ -1501,7 +1501,7 @@ public class DictionaryActivity extends AppCompatActivity { DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); scale = dm.density; - } catch (NullPointerException e) + } catch (NullPointerException ignored) {} // Convert the dps to pixels, based on density scale mPaddingDefault = (int) (PADDING_DEFAULT_DP * scale + 0.5f);