Android CursorLoader and LoaderManager Error

自作多情 提交于 2019-12-04 21:34:36

Try moving initLoader after your call to lv.setAdapter. This will ensure that onLoadFinished (and thus adapter.swapCursor(data)) will be called after the SimpleCursorAdapter has been associated with the ListView .

Also, make sure your database has a column named _id for your primary key, as the CursorAdapter won't work otherwise. _id needs to be returned as a part of the results from the CursorLoader's. Otherwise an exception will be thrown.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!