Совсем недавно context.getResources().updateConfiguration() устарел в Android API 25, и мне нужно изменить язык моего приложения, которое выбирает пользователь. Я использую этот метод, чтобы изменить язык
private void setLanguage(String language){
Locale locale = new Locale(language);
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
con.getApplicationContext().getResources().updateConfiguration(config, null);
prefData.setCurrentLanguage(language);
Intent intent = new Intent(getApplicationContext(),MainActivity.class);
startActivity(intent);
finish();
}
Но получая предупреждение об устаревшем API, я только начал разработку Android. Поэтому любое предложение будет полезно о том, как решить это предупреждение.




Я нашел код ниже в исходном коде Resource.
/**
* Store the newly updated configuration.
*
* @deprecated See {@link android.content.Context#createConfigurationContext(Configuration)}.
*/
@Deprecated
public void updateConfiguration(Configuration config, DisplayMetrics metrics) {
updateConfiguration(config, metrics, null);
}
В документе говорится, что использование вместо этого Context.createConfigurationContext(Configuration) устарело.
Попробуйте это