Skip to content Skip to sidebar Skip to footer

Listview Not Showing Up In Fragment

When I insert a listview in a fragment in my application, it doesn't show up after I populate it with items. In fact, the application crashes due to a NullPointerException. Can any

Solution 1:

I believe your crash is on this line:

listView.setAdapter(adapter);

adapter obviously is not null (the crash is not within setAdapter() anyway), so listView must be null.

ListViewlistView= (ListView) findViewById(R.id.assignlist);

Well, we can see it declared there. However, findViewById() can return null if the object is not found. There appears to be no object (and in particular, no ListView) with ID assignlist within the layout you are using (activity_course_detail.xml).

Post a Comment for "Listview Not Showing Up In Fragment"