Sunday, February 3, 2013

10. How to display local Language Text with custom font in Android

For displaying the Languages which are not supported by Android, we have to pack the font for the language along with our application package.

First Download the required font for your language (To find one just Google it) I have used Malayalam font here (https://sites.google.com/site/fontpacksite/malayalam-fonts).Then we have to copy a suitable font for your language in to the "asset" folder. For example I have used the font named "AnjaliOldLipi" for  "Malayalam" .


Now If you want to display it in to a TextView the format is as shown below, since I have saved the font inside a new folder named "fonts" I have to give "fonts/.......,ttf"

TextView tv = (TextView)findViewById(R.id.textView1);
                    Typeface typeFace = Typeface.createFromAsset(getAssets(),"fonts/AnjaliOldLipi.ttf");
                    tv.setTypeface(typeFace);
                    tv.setText("മലയാളം");   


Now it will show the corresponding text in to the TextView in your language. When you run the program or export an APK file, this font will be packed along with the APK file, so the font will work in any Android device, which do not have this font installed.

16 comments:

  1. Hello Arise,

    I have been trying to resolve Malyalam font issue by doing same as the above, even I tried many types of fonts like Meera, Dyuthi, Rachana, RaghuMalayalamSans, AnjaliOldLipi. But There is still issue of some characters if I am going for AnjaliOldLipi.

    ReplyDelete
    Replies
    1. Anjali old lipi is the best one and it works perfectly for me

      Delete
  2. Hello sir,
    I am a bigginer. Your help will be valuable for me. I succeeded to develop an android application for my malayalam blog which using Anjali Old Lipi. However the blog is not showing the letters when the blog open in the "webview" since the lack of necessary coding.. Its my dream to make a facility to make available my blog for mobile viewers who may not have malayalam facility. My mobile does not support malayalam but it can read Malayalam manorama app clearly. If manorama can make such an app why don't I? I also want to make such a facility. Pls help me. I tried all the things available in stack flow.

    ReplyDelete
  3. This information you provided in the blog that was really unique I love it!!, Thanks for sharing such a great blog..Keep posting..

    Andriod Training in Chennai

    ReplyDelete
  4. Wonderful blog.. Thanks for sharing informative blog.. its very useful to me..
    mobile apps development companies melbourne | web development Melbourne

    ReplyDelete

  5. TextView tv = (TextView)findViewById(R.id.textView1);
                        Typeface typeFace = Typeface.createFromAsset(getAssets(),"fonts/AnjaliOldLipi.ttf");
                        tv.setTypeface(typeFace);
                        tv.setText("മലയാളം");   
    tv.setText("how to type malayalam this place i dont know")

    ReplyDelete
  6. Great information here. I am so delighted to be here.Thanks for sharing in detail.
    Very helpful and useful blog.Thanks for share.
    android app development perth | android app development sydney

    ReplyDelete
  7. nemco.com.au
    Android App Development Company - Sydney, Melbourne, Perth, Brisbane, adelaide
    Nemco is one of leading android application development company provides iphone, iOS, android app development services in Sydney, Melbourne, Perth, Brisbane and adelaide.
    android app developer sydney | android app development perth

    ReplyDelete
  8. Some languages are not really supported by the system essay in uk. The special application package with the necessary font will solve the problem.

    ReplyDelete
  9. Proper planning is needed to run your marketing campaign and the major decisions is to find the right strategies that will work for your business type. I am using heymarket real estate sms app and it has truly at it so much value to our sales graph. You can also give it a try!

    ReplyDelete
  10. Wow I really enjoyed to read that all i will always follow You thanks for the great article.
    It conatains so good knowledge. Full of informative article.
    Here My website for SEO Company in Nagpur

    ReplyDelete
  11. Nice blog. Nice explanation with helpful information.
    For best astrology services contact us SEO Company in Nagpur

    ReplyDelete

Please give your valuable comments so as to know whether this blog is useful to you.You can also write helpful Android Development Syntax or Shortcuts or Tips.