Cursor and Adapter

前端 未结 2 1801
梦如初夏
梦如初夏 2020-12-06 14:38

can someone see what I have wrong with my cursor: The data from the db is not returned (at least the screen is blank). I think that is my problem. In the DDMS shows it ope

2条回答
  •  太阳男子
    2020-12-06 15:20

    Cursor databaseCursor = null;
    

    This is what you are passing to the adapter. Sure you are querying later, but you are never capturing the cursor result from that query, nor are you setting the cursor on the adapter. So since cursor is always null, you never have results.

    Oh, you also need to keep the db open while your cursor is alive. Use the startManagingCursor method on the activity rather than close the database.

提交回复
热议问题