View

Thursday 7 July 2011

How to use Multi Language in android?

How to use multi language of text in android?

Its just a easy way to use it.How ? The html decimal unicode is suppoted by android os.Here i show three languages,Tamil,hindi and Telungu.First of all u should download the DLL file.For example :
"Akshar.ttf",Its a one of the Library file,It help to convert the decimal unicode format.Your Android application there is assests folder ,you just create a new folder and name as fonts,then put inside of the "Akshar.ttf" file in that folder,Now come to our Code section.

 TextView english,tamil,hin,tel;
String tam,h,t;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        tamil=(TextView)findViewById(R.id.textView2);
        hin=(TextView)findViewById(R.id.hindi);
        tel=(TextView)findViewById(R.id.telngu);
        tam="ஸக-அன்ட்ரொஇட் அப்ப்லிகடிஒன்.ப்லொக்ஸ்பொட்.கொம்";
        h="सग-अन्ड्रोइड् अप्प्लिcअटिओन्.ब्लोग्स्पोट्.cओम्";
        t="సగ-అన్డ్రొఇడ్ అప్ప్లిcఅటిఒన్.బ్లొగ్స్పొట్.cఒమ్        ";
       
        Typeface tf=Typeface.createFromAsset(getAssets(), "fonts/Akshar.ttf");
       
      
        tamil.setTypeface(tf,Typeface.BOLD);
        tamil.setText(Html.fromHtml(tam));
       
        hin.setTypeface(tf,Typeface.ITALIC);
        hin.setText(Html.fromHtml(h));
       
       
        tel.setTypeface(tf,Typeface.NORMAL);
        tel.setText(Html.fromHtml(t));
       
    }
}


The output is:
Download full source code

4 comments:

  1. Thanks for your support.I like your blog achievement. This is one of the meaningful and useful post.
    Android app developers

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete