
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