onCreateView can't load listView
mDrawerListView = (ListView) getActivity().findViewById(R.id.navigation_list);
in this upper code
mDrawerListView is Null Object
this is fragment_navation_drawer.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#cccc"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:id="@+id/navigation_list"
android:dividerHeight="0dp"/>
</LinearLayout>
if i don't use LinearLayout and just use only ListView
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#cccc"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:id="@+id/navigation_list"
android:dividerHeight="0dp"/>
like this xml and use
mDrawerListView = (ListView) inflater.inflate(
R.layout.fragment_navigation_drawer, container, false);
this code is work
how to call listview from fragment linearlayout?
change code like this
mDrawerListView = (ListView) inflater.inflate(
R.layout.fragment_navigation_drawer, container, false).findViewById(R.id.navigation_list);
this can call listView but other error
Caused by: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.