This code part of a method always causes the app to restart. It's not a crash, just a restart without any error messages. The curious thing, so far I have only discovered this behavior with Nokia 8 (Android 9) and Samsung Note 20 Ultra (Android 12).
The code is inside FragmentSettings, so it's the Settings menu item in the app. If the user makes any changes in it, the app will be restarted afterwards. With the smartphones mentioned above, the app is restarted directly as soon as the user wants to call up "Settings". So the user does not even have the opportunity to make changes.
I know this isn't a lot of code I'm showing here, but do you have any suspicions as to why this phenomenon is happening?
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
LocaleManager.setNewLocale(getContext(), countryToCode.get(spinner.getSelectedItem().toString()));
requireActivity().finish();
Intent i = new Intent(getActivity(), ActivityMain.class);
i.putExtra("RELOAD_VALUES", true);
startActivity(i);
}
@Override
public void onNothingSelected(AdapterView<?> parentView) {
}
});