android – 更改CursorAdapter中的Cursor

android – 更改CursorAdapter中的Cursor,第1张

概述我试图通过这种方式更改CursorAdapter中的Cursor: Cursor newCursor = compiledStatement.getCursor();startManagingCursor(newCursor);adapter.changeCursor(newCursor); 不幸的是,我得到了这个例外: java.lang.IllegalStateException: att 我试图通过这种方式更改CursorAdapter中的Cursor:

Cursor newCursor = compiledStatement.getCursor();startManagingCursor(newCursor);adapter.changeCursor(newCursor);@H_404_12@  

不幸的是,我得到了这个例外:

java.lang.IllegalStateException: attempt to re-open an already-closed object:     androID.database.sqlite.sqlitequery@H_404_12@  

根据其他主题,应该可以在不创建新内容的情况下更改CursorAdapter的内容.

解决方法 我发现了这个问题.我的CursorAdapter实现了SectionIndexer,所以我不得不owerwrite changeCursor()方法并重置AlphabetIndexer的Cursor.

@OverrIDepublic voID changeCursor(Cursor cursor) {    mIndexer.setCursor(cursor);    super.changeCursor(cursor);}@H_404_12@                            	          总结       

以上是内存溢出为你收集整理的android – 更改CursorAdapter中的Cursor全部内容,希望文章能够帮你解决android – 更改CursorAdapter中的Cursor所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1129622.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存