Skip to content Skip to sidebar Skip to footer

Listview Shows No Data While Populating Through Cursor

I am new to Android development. I am using ListView to list some data from SQLite database. my Main.xml file looks like:

Solution 1:

I was trying different things & when i removed the "Header" & "List Divider" sections from my main.xml it worked. Very Strange??

So my main.xml now looks like:

<?xml version="1.0" encoding="utf-8"?><LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/inspections"android:orientation="horizontal"android:layout_width="fill_parent"android:layout_height="fill_parent"><!-- ListView (grid_items) --><LinearLayoutandroid:id="@+id/layout"android:layout_width="wrap_content"android:layout_height="fill_parent"><ListViewandroid:id="@+id/mylistview"android:layout_height="fill_parent"android:layout_width="fill_parent"></ListView></LinearLayout></LinearLayout>

Can somebody comment on this strange behavior of listview?

Solution 2:

You might have already found out but, the primary LinearLayout has a horizontal orientation. Every child view that you will add will be added horizontally next to it. Since your first view, "@+id/header", takes up the whole width of the screen the other views will be added outside of the screen.

If you change the orientation of "@+id/inspections" into "vertical" all your views will be visible.

Post a Comment for "Listview Shows No Data While Populating Through Cursor"