Feb 10, 2012

Hindi on an Android Phone

This is just an app I am developing on the side. It uses Devanagari scripts to render the text, rather than displaying images as most of the similar apps in the Android Markets do.

Part 1 of the problem was how to load the hindi font in the code and get the display to render it. If you try this on a phone without Hindi support - which is the vast majority of the phones out there, then all you see is squares instead of the text.



This was pretty simple. If you want to load a custom font, this is what you do :


  1. Get the specific font you want to bundle with your application. Lets call it Hindi.ttf
  2. Put it in your project under the "assets/fonts" folder. You will need to create the folder 'fonts'. Not necessary to have the exact name, but I use it as it denotes what the files int the folder are. 
  3. Now you need to tweak your code a bit as you need to load the font before you render the text. This is quite simple - use something like the following :


//Font work
Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/Hindi.ttf");
// Get the UI element handles
mText = (TextView)findViewById(R.id.body_text);
// Set the title and read the file for the text
mText.setText(readRawTxt(pName));
mText.setMovementMethod(new ScrollingMovementMethod());
mText.setTypeface(tf); // setting font for the text. 
 Now when you run the program, you will get the fonts loaded and rendered, which brings use to Part 2 of the problem.

Part 2 of the problem is that the maatras are not getting aligned properly. For this I have so far not been able to figure out how to fix it. If you know , let me know. If I get to know about it, I will update this post.



Tips on purchasing an Android Phone

Here are some tips which I think you may find useful when you are looking to buy an Android phone.

Unlike the iPhone , the Android mobile space has a huge number of variants, which is good and bad at the same time. Good - cause you get variety ( though the current designs all seem to be very similar) , and Bad as you cant figure out what to buy !

My tips below will be looking beyond the advertized features of the phone. So, you will have to read the specifications of the phone you are trying to get and see if it fits for you!

Tip#0 : Wait for ICS

ICS is the next version of Android ( Version 4.0 ) but it is still not available in the market. So, if you can wait then wait for the phones with the new versions to be available.

Android 4.0


Tip#1 : Check for available custom ROMs

When you buy an Android phone from a manufacturer, you will end up with a system with a lot of customizations from the manufacturer. Its like how you go and buy a laptop and get all the preinstalled software. Now, you may actually want this, in which case you can ignore this tip. But, you may also be thinking that this is a lot of bloatware. Not only does it reduce the amount of space that you have available in the phone, it also causes your battery to drain much faster and slows down the phone.

So, have a look at the mods available in the market. I used the Cyanogenmod for installing onto my phone:

Samsung Galaxy ACE running CyanogenMOD7


Some sites you can refer to :
1. Cyanogenmod
2. MIUI
3. XDA Developers

Please note : by flashing the new OS you will void any guarantee from the manufacturer and also you have a risk of bricking your phone. Take all backups and then take them again. Use recovery mechanisms to take backup of the actual OS.

Tip#2 : Check the battery

Don't go by the claims from the manufacturers about the uptime. Its usually by turning off all the features and on a stock device. It falls flat on the face in actual use - the gap is quite large. The one thing you can do now is to look at the mAh rating on the device. Minimally it should be above 1500mAh for lasting around a day. The more the better it is.

Tip#3 : Check the internal memory

The advertisements will be pointing out that you can get upto 32GB of memory by using a SD Card. Ignore that. It is true, but it is not what you are looking at. You are looking at the internal memory present on the device. Look for things which are atleast 2 GB if not more.

Why ? Because most of the apps to function properly need to use the internal memory. Some can function only if they are installed in that part ( e.g. enterprise software ) and almost all require the memory to store user related data. The external SD card is where you store the pictures/videos/songs etc  ( and can move some apps to that area also)

Tip#4 : Now look at other specs
Now you are free to look at the other specs that are available on the phone which you may like. But if you neglect the above 4 tips, i am pretty sure you will end up wishing you hadn't.


Feb 5, 2012

Hard Re-setting Galaxy Ace

Recently, I had a bit of a problem with my phone - the Samsung Galaxy Ace. Apart from being pretty annoyed with Samsung for giving next to no internal memory (150MB only), the phone was eating up battery quite fast and becoming quite slow. So , I decided to hard reset it. Problem is - the information about android phones is too much in plenty and scattered all over the blogs. So, here are the ways you can do it:

1. Enter Recovery Mode
Press the home key and the power key simultaneously. 
When you see the Samsung logo , let go and you get into recovery mode.

2. From the dial pad
Enter the following key strokes:
*2767*3855#

3. From the phone itself.
Go to settings->Privacy Settings -> Factory data reset