tags:

views:

182

answers:

1

This is the code I used but every time I excute it force to stop. note that I use it on android 2.1

package com.arb;

import android.app.Activity;

import android.os.Bundle;
import android.widget.TextView;
import android.content.res.AssetManager;
import android.graphics.Typeface;

public class arabi extends Activity
{
AssetManager arabi_font;

TextView tx;


    /** Called when the activity is first created. */
    @Override

    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
tx=(TextView) this.findViewById(R.id.tt);

try{

arabi_font.open("DejaVuSans.ttf");

//DejaVuSans.ttf font file

tx.setTypeface(Typeface.createFromAsset(arabi_font,"DejaVuSans.ttf"));
tx.setText("\uFEB3\uFE92\uFE98\uFE94");
}


catch(Exception ex){
} 


}
}
A: 

Try this, I've just recode several lines, I belive it's working...

try{

   //arabi_font.open("DejaVuSans.ttf");

   //DejaVuSans.ttf font file

   tx.setTypeface(Typeface.createFromAsset(getAssets(),"DejaVuSans.ttf"));
   tx.setText("\uFEB3\uFE92\uFE98\uFE94");

} catch(Exception ex){ }

Khirulnizam
thanx I found the answer
SultanSh