Code example for MessageFormat

Methods: applyPattern, setLocale, toPattern

        String pattern = "A {3, number, currency} B {2, time} C {0, number, percent} D {4}  E {1,choice,0#off|1#on} F {0, date}";
        format1 = new MessageFormat(pattern);
    public void test_applyPatternLjava_lang_String_AndroidFailure() { 
        MessageFormat format = new MessageFormat("test");
        format.setLocale(Locale.FRENCH); // use French since English has the
        // same LONG and FULL time patterns 
        format.applyPattern("{0,time, Full}");
        assertEquals("Wrong full time pattern", "{0,time,full}", format
    public void test_formatToCharacterIteratorLjava_lang_Object() { 
        // Test for method formatToCharacterIterator(java.lang.Object) 
        new Support_MessageFormat( 
        try { 
            new MessageFormat("{1, number}").formatToCharacterIterator(null);