David,

I *think* your ListView is obscured by other views in playerlist.xml, or just has zero width/height.

There is a bunch of views with fill_parent/fill_parent width and height... In fact it seems that the LinearLayout which is the parent of your ListView is pushed off the screen by the second (in the order of occurrence) LinearLayout, which is the header layout.

I would recommend removing everything from the layout except for ListView, sizing it fill_parent / fill_parent, verifying that this works, and then adding other views one step at a time.

-- Kostya

22.04.2011 1:43, David Williams пишет:
Well, I did do a check on the cursor.getCount() and it did return a value of 1, which is what I was expecting. So, the issue must be with displaying the data. Here is my code for populating the data and displaying it, which I've taken from the notepad tutorial. Would appreciate any help.

private void getAllPlayers() {
        // Get all of the notes from the database and create the item list
//playerCursor = dbHelper.queryTable(PLAYERS_TABLE, ALL_PLAYER_COLS, null, null, null, null, null);
        playerCursor = dbHelper.rawQuery("SELECT * FROM players;");
        int pCount = playerCursor.getCount();
        startManagingCursor(playerCursor);

String[] plyData = new String[] { PLAYERS_SEX, PLAYERS_NAME, PLAYERS_HANDICAP }; int[] plyCols = new int[] { R.id.plyIcon ,R.id.plyName, R.id.plyHandicap };

        // Now create an array adapter and set it to display using our row
        ListAdapter plyAdapter =
new SimpleCursorAdapter(this, R.layout.players_rows, playerCursor, plyData, plyCols);
        setListAdapter(plyAdapter);
    }

My 2 layouts for this are as follows:
*playerslist.xml*
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">
<LinearLayout android:orientation="horizontal"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent">
<ImageView android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="0"
        android:gravity="left"
        />
<TextView android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Name"
        android:textSize="20sp"
        android:layout_weight="1"
        android:textColor="#FFFF00"
        android:gravity="center"
        />
<TextView android:textSize="20sp"
        android:id="@+id/textView1"
        android:layout_height="wrap_content"
        android:textColor="#FFFF00"
        android:text="Handicap"
        android:layout_weight="0"
        android:gravity="right"
        android:layout_width="wrap_content"
    />
</LinearLayout>
<LinearLayout android:orientation="horizontal"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent">
<ListView android:id="@android:id/list"
          android:paddingBottom="10px"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>
<TextView android:id="@android:id/empty"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="@string/no_players"/>
</LinearLayout>
</LinearLayout>


*players_rows.xml*
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:orientation="vertical">
<ImageView
        android:id="@+id/plyIcon"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0"
        android:gravity="left"
        />
<TextView
          android:id="@+id/plyName"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:textSize="14sp"
          android:textColor="#FFFFFF"
          android:gravity="left">
</TextView>
<TextView
          android:id="@+id/plyHandicap"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:textSize="14sp"
          android:textColor="#FFFFFF"
          android:gravity="right">
</TextView>
</LinearLayout>
------------------------------------------------------------------------

David Williams
Check out our WebOS mobile phone app for the Palm Pre and Pixi:
<http://www.dtw-consulting.com/GolfCaddie> Golf Caddie <http://www.dtw-consulting.com/GolfCaddie> | Golf Caddie Forum <http://www.dtw-consulting.com/GolfCaddie/forum> | Golf Caddie FAQ <http://www.dtw-consulting.com/GolfCaddie/faq.html> by DTW-Consulting, Inc.




--
Kostya Vasilyev -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to