AsyncTasks에서 Fragements로 앱을 포팅합니다.ListFragment listView를 얻는 방법?
그러나 내 조각 내에서 listView (id : list) 요소에 액세스하려면 어떻게해야합니까?
class MyFragment extends ListFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.list_fragment, container, false);
ListView listView = getListView(); //EX:
listView.setTextFilterEnabled(true);
registerForContextMenu(listView);
return v;
}
}
XML :
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ListView>
예 :
Caused by: java.lang.IllegalStateException: Content view not yet created
http://stackoverflow.com/questions/9286391/android-why-is-this-telling-me-content-view-not-yet-created –