Can I access to resources from different locale android?

The better solution would be (if you’re on API 17):

@NonNull
protected String getEnglishString() {
    Configuration configuration = getEnglishConfiguration();

    return getContext().createConfigurationContext(configuration).getResources().getString(message);
}

@NonNull
private Configuration getEnglishConfiguration() {
    Configuration configuration = new Configuration(getContext().getResources().getConfiguration());
    configuration.setLocale(new Locale("en"));
    return configuration;
}

Leave a Comment