안녕하세요.

ListView에 항목을 추가하고 마지막으로 아래와 같이 풋터를 추가하였습니다.
--------------------------------------------------
View v = getLayoutInflater().inflate(R.layout.footerview, null, false);
......중략....
TextView tv = (TextView)findViewById(R.id.footText);
tv.setText("내용변경");   <<<<<<  java.lang.NullPointerException 발생
getListView().addFooterView(v);
......중략....
----------------------------------------------------

footText.xml 내용은
------------------------------------------------------
<?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="48dp"
   android:layout_gravity="center_vertical"
 android:orientation="vertical"
 android:paddingTop="10dp"
 android:background="#FF7F7F7F"
   >
 
 <TextView android:text="Footer Test"
  android:id="@+id/footText"
  android:layout_width="wrap_content"
     android:layout_height="30dp"
     android:textSize="12dp"
     android:layout_gravity="center"
     android:textColor="#FFFFFFFF"
 />
</LinearLayout>
------------------------------------------------------

그런데 위에 표시한 부분에 오류가 납니다.
오류가 나는 부분을 주석처리하면 오류가 없습니다.
무슨 이유인지 고수님들의 답변 부탁드립니다.
profile

give & take