0

SOLVED

I have a text box inside an XML file called list_entry.xml. The code for the file is as such:

<?xml version="1.0" encoding="utf-8"?>
<TextView  
    xmlns:android="http://schemas.android.com/apk/res/android"  
    android:id="@+id/list_entry_title"  
    android:layout_width="fill_parent"   
    android:layout_height="wrap_content"  
    android:paddingTop="1dip"  
    android:paddingBottom="1dip"  
    android:paddingLeft="5dip"  
    style="android:attr/listViewWhiteStyle" />

So it's not too complicated. My question is: how do you access the "list_entry_title" textbox? I keep getting crashes (NullPointerException) when I try to use list_entry as a textbox.

4

1 回答 1

0

原来我犯了一个愚蠢的错误;尝试访问文本框时,我使用了 R.layout 而不是 R.id。感谢所有评论的人!

于 2013-07-25T15:08:18.380 回答