@Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); if (hasFocus) { if (Utils.isRestartNeeded) { restartSelf(); return; } if (mPreferences.isLocationSet()) { TextView notes = (TextView) findViewById(R.id.notes); assert notes != null; notes.setText(null); } } }