Why does the name of the Fragment not change when changing the language?
---------- Class Application
public class BaseApp extends Application{ public static Context context; @Override public void onCreate() { super.onCreate(); context=getApplicationContext(); } } ---------- Class Constans are simple
public final class Constants { // Screen titles public static final String LOGIN_FRAGMENT_TAG = BaseApp.context.getString(R.string.const_login); public static final String MY_LEARNING_FRAGMENT_TAG = BaseApp.context.getString(R.string.const_my_learning); } ---------- A function that changes the language.
Locale myLocale = new Locale(lang); Configuration configuration = BaseApp.context.getResources().getConfiguration(); configuration.setLayoutDirection(myLocale); getResources().updateConfiguration(configuration, getResources().getDisplayMetrics()); Intent goToMainActivity = new Intent(getActivity(), LoginActivity.class); startActivity(goToMainActivity); getActivity().finish(); In general, the whole thing works only after restarting the application. I understand how something is wrong with the class Constants. How can you make it work