diff --git a/app/src/main/java/com/emanuelef/remote_capture/activities/prefs/SettingsActivity.java b/app/src/main/java/com/emanuelef/remote_capture/activities/prefs/SettingsActivity.java index 7be3f9027..b059ec1c1 100644 --- a/app/src/main/java/com/emanuelef/remote_capture/activities/prefs/SettingsActivity.java +++ b/app/src/main/java/com/emanuelef/remote_capture/activities/prefs/SettingsActivity.java @@ -127,13 +127,20 @@ public void onBackStackChanged() { public void onBackPressed() { Fragment f = getSupportFragmentManager().findFragmentById(R.id.settings_container); if(f instanceof SettingsFragment) { - // Use a custom intent to provide "up" navigation after ACTION_LANG_RESTART took place - Intent intent = new Intent(this, MainActivity.class); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - startActivity(intent); - finish(); - } else - super.onBackPressed(); + Intent intent = getIntent(); + + if ((intent != null) && SettingsActivity.ACTION_LANG_RESTART.equals(intent.getAction())) { + // Use a custom intent to provide "up" navigation after ACTION_LANG_RESTART took place + intent = new Intent(this, MainActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + finish(); + return; + } + } + + // default behavior + super.onBackPressed(); } public static class SettingsFragment extends PreferenceFragmentCompat {