我有我的android活動的自定義字體。Android的自定義字體列表視圖
MainActivity.class
private void initControls() {
// TODO Auto-generated method stub
header = (TextView) findViewById (R.id.tvAccommodations);
lv = (ListView) findViewById (R.id.lvAccommodations);
text = (TextView) findViewById (R.id.textView);
Typeface tf = Typeface.createFromAsset(getAssets(),
"fonts/heartbre.ttf");
header.setTypeface(tf);
text.setTypeface(tf);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
R.array.abra_hotel, R.layout.custom_list_text);
lv.setAdapter(adapter);
header.setText(value);
custom_list_text.xml
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/list_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="18sp"
android:textStyle="bold"
android:text="@string/app_name"
android:paddingLeft="6dip" />
的Android拋出NullPointerException異常。爲什麼這樣?任何幫助表示讚賞。謝謝。
logcat的:
03-08 19:48:03.859: E/AndroidRuntime(413): Caused by: java.lang.NullPointerException
03-08 19:48:03.859: E/AndroidRuntime(413): at com.say.philippineexplorer.PlaceAccommodations.initControls(PlaceAccommodations.java:34)
03-08 19:48:03.859: E/AndroidRuntime(413): at com.say.philippineexplorer.PlaceAccommodations.onCreate(PlaceAccommodations.java:22)
你可以把日誌 – DjHacktorReborn 2013-03-08 11:56:15
發佈日誌異常 – Sri 2013-03-08 11:57:30
@DjHacktorReborn我更新了我的文章 – 2013-03-08 12:06:31