应用程序意外停止 [英] The application has stopped unexpectedly

查看:60
本文介绍了应用程序意外停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在尝试在我的应用程序中显示farsi textview,但是关闭应用程序时出错。

这是我的Main.java代码:

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;
}





这是我的xml代码:



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.

推荐答案

我自己解决了这个问题;

我使用它的字体在项目下不存在所以问题成了。
I'v solved this myself;
the font I used it doesn't exist under the project so the problem was made.


这篇关于应用程序意外停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆