뷰 스텁에 문제가 있습니다. ViewStub NullPointerException
이
내 자바 파일ViewStub stub = (ViewStub) findViewById(R.id.stub1);
ArrayAdapter<String> content=new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,files);
View inflated=stub.inflate();
ListView people=(ListView)inflated.findViewById(R.id.friends);
people.setAdapter(content);
이 내가
다음과 뷰 스텁에서 팽창<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id = "@+id/linear_details" >
<include layout="@layout/home_back_next_bar" />
<ViewStub android:id="@+id/stub1" android:inflatedId="@+id/showlayout"
android:layout="@layout/layout1" android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</merge>
내 레이아웃 파일입니다으로 Viewstub를 초기화 XML입니다에 ViewStub입니다 :
<?xml version="1.0" encoding="utf-8"?>
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/friends"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
이 코드는 listview의 인스턴스를 작성할 때 NullPointerException을 발생시킵니다. 그것. 모든 아이디어이 문제의 원인 및 해결 방법. 로그인 고양이에서 미리
오류를 많이
감사 :
로그에 널 포인터 예외를 표시하십시오. –