Click here to Skip to main content
15,893,266 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I'm trying to display farsi textview in my application,but it has error to close the application.
This is my code of Main.java:
public class MainActivity extends Activity {

TextView txt;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
		
txt = (TextView) findViewById(R.id.textview1);
		
Typeface face = Farsi.GetFarsiFont(this);
txt.setTypeface(face);
txt.setText(Farsi.Convert("سلام"));
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}


and this is my xml code :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<TextView
android:id="@+id/textview1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text="@string/hello_world" />

</LinearLayout>


when I comment
Typeface face = Farsi.GetFarsiFont(this);
txt.setTypeface(face);
txt.setText(Farsi.Convert("سلام"));

it work properly.
Please help me what i should do.
Posted

1 solution

I'v solved this myself;
the font I used it doesn't exist under the project so the problem was made.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900