android.database.CursorIndexOutOfBoundsException: Index <m> requested, with a size of <n>

遇到这样的问题比较郁闷,造成上述问题的原因也是多种多样的。

总结一下原因:

1:得到cursor对象,没有moveToPosition()或者moveToNext()等游标操作就进行cursor.getXX操作。

这种情况比较多。

2:使用MeargeCursor。而Cursor对象只有一个。这是郁闷了我两天的bug,现在已修复。

new MergeCursor(new Cursor[]{contactCursor})


本着具体问题具体分析的原则,上述两条方案只能帮助你进行分析问题。

原文地址:https://www.cnblogs.com/jiangu66/p/3184879.html