Maybe the data was never inserted into the table to begin with?

"Select * from some_table" is pretty much as low-level as you can get for
testing (short of copying the database off the device to use the command
line sqlite3 tool).

You could also try calling cursor.getCount() as a sanity check.
21.04.2011 17:21 пользователь "David Williams" <[email protected]>
написал:
> Thanks for that. I am also stopping and debugging the code when reading
> and displaying the cursor, but I am still not seeing anything.
> The code is what is used in the notepad tutorial so it obviously works
> there.
>
> 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;");
>
> startManagingCursor(playerCursor);
>
> String[] from = new String[] { PLAYERS_NAME };
> int[] to = new int[] { R.id.playerData };
>
> // Now create an array adapter and set it to display using our row
> SimpleCursorAdapter players =
> new SimpleCursorAdapter(this, R.layout.players_rows,
> playerCursor, from, to);
> setListAdapter(players);
> }
> ------------------------------------------------------------------------
>
> 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.
>
>
>
> On 4/21/2011 12:57 AM, Zsolt Vasvari wrote:
>> The Cursor won't get filled until you try to retrieve the first row.
>> So if you are stopping the program on the rawQuery, you won't see
>> anything.
>>
>> On Apr 21, 9:03 am, David Williams<[email protected]>
>> wrote:
>>> Tried that but it didn't make any difference.
>>>
>>> This is weird and I can't work out why the query is not returning any
rows.
>>> Is there something else in the debugger I need to be looking at? As
>>> mentioned before, when I copy the DB down to my computer I can see that
>>> there are records there created when my app is first launched.
>>>
>>> Does the NO_COUNT = -1 (for the cursor) mean that no rows were returned?
>>> ------------------------------------------------------------------------
>>>
>>> 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.
>>>
>>> On 4/19/2011 10:20 PM, lbendlin wrote:
>>>
>>>
>>>
>>>> Would you be willing to try a raw query?
>>>> Cursor c = db.rawQuery("SELECT * FROM players", null);
>>>> if (c != null) {
>>>> if (c.moveToFirst()) {
>>>> do {
>>>> int id = c.getInt(0);
>>>> // other fields etc
>>>> } while (c.moveToNext());
>>>> }
>>>> c.close();
>>>> }
>>>> Might be easier to debug.
>>>> --
>>>> 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- Hide quoted
text -
>>> - Show quoted text -
>
> --
> 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

-- 
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