kBLOG

All things about Life, Oracle Middleware and Technology

Arabic Language in Android

| 179 Comments

Arabic Android

Arabic Android

Thanks to Ahmad Essam‘s Article about google android, I had the ArabicReshaper.java file and made some enhancements.

With the help of this person, I was able to develop my first Arabic writer program that proves that Android is Arabic support and hopefully to have a fully functional application that read/write Arabic and may help other applications that need Arabic support to find their purpose perfectly.

Updated: now check this link for the SMS Arabic Mobile Manager

First the file lacked some enhancements regarding the placing of the letters, but it almost was complete, i only did a small touch and it was complete.

But the Reshaper class is only processing one word, it couldnt be a good success to combine arabic english letters, or add a space, so i made my helper class, ArabicUtilities.java with four functions in it, to determine if the text contain arabic letters, and to reshape a whole text containing english, Arabic and others.

The Tricky part was to insert the font to be working with, as described in Ahmad Essam’s blog article “How Does Arabization Work” that the free type font is already supported, and BiDi is already supported, so just reshaping and have a freetype font and your good to go, so how to load my arabic free type font library without having to force it in my SDK, because it wouldnt be reasonable to have this in a real working mobile.

The answer to that is really simple actually, in Android they provided a great thing called Asset Manager where i can have my read-only files to load them as streams or with whatever way i want -helpful for configurations and stuff-, and with a little help of java Font library it was done by only a few lines of code here is the snippet


AssetManager manager=this.getAssets();
try
{
manager.open("tahoma.ttf");
TextView tv=(TextView)this.findViewById(R.id.testMe);
tv.setTypeface(Typeface.createFromAsset(manager, "tahoma.ttf"));
tv.setTextSize(50f);
tv.setText(ArabicUtilities.reshape("adsdads الحمد لله asdad"));
}catch(Exception ex){
//TODO
}

and Hopp it all went great, and my android start reading Arabic like it was born doing it!

I’ll be putting the solution online for download soon, just need to modify few issues first.

Updated: now check this link for the SMS Arabic Mobile Manager

Updated: new news considering Android Application in here

Share on... Tweet about this on TwitterShare on FacebookShare on LinkedInShare on Google+Flattr the author
  • moudavich

    hello

    Please how to support arabic reshaping in browser in my emulator

    android?

    And I haven’t found system/lib in my windows seven

    Please help!!!

  • http://blog.amr-gawish.com agawish

    Android browser is another issue, as it requires alternating the core Android System.

  • http://blog.amr-gawish.com agawish

    Android browser is another issue, as it requires alternating the core Android System.

  • moudavich

    Can you help to support arabic in browser to emulator by any tutorial?????

  • moudavich

    Can you help to support arabic in browser to emulator by any tutorial?????

  • http://www.cyanogen4arab.com Ahmed Shaban

    Amr is a genius and his code for reshaping is used all over. Even in our arabization of Caynogen codes at http://www.cyanogen4arab.com Credits for Amr is of course maintained.

  • http://www.cyanogen4arab.com Ahmed Shaban

    Amr is a genius and his code for reshaping is used all over. Even in our arabization of Caynogen codes at http://www.cyanogen4arab.com Credits for Amr is of course maintained.

  • Amalik

    Dear Gawish
    I download the android source and cyanogen kernel source ,
    In which folder I have to download git://github.com/agawish/Better-Arabic-Reshaper.git in mydroid folder or .. thanks.

  • Amalik

    Dear Gawish
    I download the android source and cyanogen kernel source ,
    In which folder I have to download git://github.com/agawish/Better-Arabic-Reshaper.git in mydroid folder or .. thanks.

  • Amin

    للاسف الشديد لم افهم اي كلمة مما كتب اعلاه, وصلت لهده الصفحة من موقع اندرويد العربي الموجود بقوقل والذي توجد فيه معلومات باللغة العربي عن قاري الرسائل العربي و مصممه الاخ عمر ..
    اذا كنا نحن العرب نستخدم اللغة الانجليزية والمطورين العرب يتسخدمون اللعة الانجليزية حتى عندنا يصنعون برنامج لدعم العربي, فلما ندعم العربي اذا؟

  • aviv
  • Mena_egipto

    any body can help me plz to find how to read araic in my epad ???

  • http://profiles.google.com/assadesign Patrick N. Assad

    hi sir i have android 2.1 how to support arabic language to my sms and browser.
    my phone only comes with russian and english please i need your help for this
    thanks for your coperation

  • Yahya

    Hello..
    from where do i get the ArabicUtilities ?

  • abiisyarfaq

    ASSLAMUALAIKU,
    Im from Indonesia. I’ve tried to install the codes/scripts, but always failed. My device is samsung galaxy mini with froyo 2.2.1. My device can read and write arabic but the letters are not connected and the orientation not from right to left as its should be. Would you help me with step by step guidence please. I very need my android support arabic because i use several arabic book for teaching, reading, and researching. Help me please. Syukran

  • Hedaya

    I’ve been trying to make Arabic work on my nook but to no avail.  I’m using calibre with the following CSS:
    @font-face {
    font-family: “Simpo”;
    font-weight: normal;
    font-style: normal;
    src: url(res:///sdcard/font/Simpo.ttf);
    }
    @font-face {
    font-family: “Simpo”;
    font-weight: bold;
    font-style: normal;
    src: url(res:///sdcard/font/Simpbdo.ttf);
    }

    body { font-family: “Simp”, serif;}
    Anyone out there no how to do it?  Should I label instead of sdcard, the name of the card or something?

  • Mabetkar

    Güvenlik Hizmetleri Kamera Alarm Sistemleri

    Güvenlik Hizmetleri | Özel Güvenlik | Kamera ve Alarm Sistemleri

  • Mabetkar
  • Turbomq

    You don’t need to all that. Quick fix is to download opera. Browser mini from android market and browse arabic web sites through it. Successfuly I’ve done.and this is my last android phone next phone is iphone where I don’t have to wory about such aproblem. Do you copy google?

  • Turbomq

    Just download opera mini browser from market and surf arabic web sites through it. Worked great with me.
    Mq

  • Turbomq

    You don’t need to go throgh that just download opera mini app.from android market and surf arabic web sites throughiy. Spead the word.

  • http://usb3gvn.com/ USB 3G Viettel

    Excellent, I just passed this onto a colleague who was doing a little research on that. Thank for this imformation.

  • http://bigcontact.com/stevenyoung Willie Tyler

    I am very pleased to find this blog. I want to thank for your time for this wonderful read!!! Keep Sharing, I’ll surely be looking for more.

  • Prvnjuluri

    if i use reshaper class it is workinf fine but i am getting LA issue in arabic
    can any one helps……??
    thanks.

  • Farid_persian

    Hello there,

    Thanks for your effort. Just a question, I used another reshaper class
    and worked fine, but I had a problem to draw text on canvas with it.
    Actually It had no effect on canvas. Would you please help me?

    canvas.drawText(DariGlyphUtils.reshape(“سلام”), 50, y, paint);

  • William Kinaan

    where is the jar file contains arabicUtilities file ?

  • dano J

    Salam Ali,
    Hope you have found help for your problem. But BBC and others like it are NOT helping your freedom, sure they will help you ‘fight’ but not for freedom-just among yourselves and also make YOU destabilize your government and destroy your army after which they will step in and grab your oil. Look what is happening in Iraq, Libya Afghanistan and Somalia and other nations
    .
    No doubt you must fight injustice and don’t stand for government tyranny but please, please don’t be fooled into letting some Zionist organization into helping you. Iran is a great country with a grand history I wouldn’t want it to be destroyed like they’re doing in Syria. The only way to free Iran, for any reasons (I see it as the most free Islamic nation-the rest are all occupied.) without destroying it is for Iran to be freed by the Iranians themselves. We are ALL brothers. Dwellers of one Earth which we ALL love.

  • dano J

    I think I’ll try your suggestion and leave the programming mumbojumbo to the pro.

  • http://quindev.com Ayman

    There are some apps available on Play Store that do the same thing and enable reading Arabic content on unsupported devices

    for example: Arabic Text Reader
    https://play.google.com/store/apps/details?id=quindev.products.arabic&hl=en