Code example for Locale

0
            locale = Locale.getDefault();
        } else if (language.length() == 5 && language.charAt(2) == '_') {
            // language is in the form: en_US 
            locale = new Locale(language.substring(0, 2), language.substring(3));
        } else { 
            locale = new Locale(language);
        } 
 
        Configuration config = new Configuration();
        config.locale = locale;
        Resources resources = context.getResources();
        resources.updateConfiguration(config, resources.getDisplayMetrics());
    } 
 
 
    /** 
     * Base activities need to implement this interface. 
     * 
     * <p>The implementing class simply has to call through to the implementation of these methods 
     * in {@link K9ActivityCommon}.</p> 
     */