Wednesday, January 18, 2017

android - Bengali unicoded character showing problem

I have created an android application where I want to display unicoded bengali sentences.
For this I have done the following steps.



Step1: I store my bengali font named Siyamrupali.ttf in the Assets folder.



Step2: In main.xml file I took a text view where I display characters.



Step3: In my MainActivity. Java I wrote this...



public class mainAc extends Activity 

{

AssetManager arabi_font;

TextView tx;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

tx=(TextView)findViewById(R.id.tv);
try
{
String str="\u0986";
tx.setTypeface(Typeface.createFromAsset(getAssets(),"Siyamrupali.ttf"));
tx.setText(str);
}
catch(Exception ex)
{
tx.setText("font cannot load: "+ ex.toString() );

}
}


Then output show Which one is correct But When i wrote String str="\u0986\u09AE\u09Bf";
In MainActivity. Java



Then output shows আমই But i should be আমি



What can I do now to solve this problem. Any body give me some advice or link or sample code.

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...