adapter = new SimpleCursorAdapter( /* query the SQLite db */);
I can't understand why cursor may be null, since onResume() it's clearly
initialized by
the query.
You would expect so, but it couldn't hurt to check (as a debugging test) if
adapter.getCursor() actually returns a valid cursor immediately after the
call to new SimpleCursorAdapter() above.
It might also be worth checking that the adapter instance you set into the
list view in onResume() and the one you are subsequently seeing in
onClickItem() are one and the same. Again, you'd expect it to be, but at
this point you've got little to lose by checking.
Just as a sanity check, make sure onResume() *is* being called as you
expect, before onClickItem() fires. Stranger things have happened...
it's clearly initialized by the query
...
since obviously it must be non-null
If programming (and running into problems) can teach you one thing,
hopefully it will be that making assumptions is a mistake {:v) There is
nothing in the docs for the SimpleCursorAdapter constructor that says it
*guarantees* a valid cursor after the operation, even though that is the
logical expectation.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en