for(int j=0; j<ServiceProviderCal.ap_title_arr.size();j++)
{
if(ServiceProviderCal.ap_title_arr.get(position).isEmpty())
{
Holder.relative.setBackgroundColor(android.graphics.Color.rgb(255, 255,255));
}
else
{
Holder.txtNote1.setText(notes.get(position)+" For:");
Holder.txtNote2.setText(des.get(position));
Holder.relative.setBackgroundColor(android.graphics.Color.rgb(255, 255,0));
//Log.e("Notes...", ""+notes);
}
}
-3
A
回答
5
此:
for(int j=0; j<=ServiceProviderCal.ap_title_arr.size();j++) {
应该是:
for(int j=0; j<ServiceProviderCal.ap_title_arr.size();j++) {
数组索引从0开始,所以当你有一个数组大小为8,其中最大指数为7.
0
在您的代码中,您正在使用
Holder.txtNote1.setText(notes.get(position)+" For:");
Holder.txtNote2.setText(des.get(position));
什么是笔记和des。我相信错误来自此代码。
notes
和des
数组列表值应等于ServiceProviderCal.ap_title_arr.size()
所以通过登录notes
和des
数组的大小调试代码。
+0
笔记和DES是数组列表..我添加约会笔记是我的标题和DES是我的描述。它在列表视图中添加.. – Google
+0
我知道笔记和des是arraylist。您正在使用des.get(位置),位置值取决于ap_title_arr大小。所以des和notes数组的大小也应该等于ap_title_arr的大小。 –
相关问题
- 1. java.lang.IndexOutOfBoundsException:索引8无效,大小为0
- 2. 引起:java.lang.IndexOutOfBoundsException:无效索引8,大小为8
- 3. 对于每个循环错误: - java.lang.IndexOutOfBoundsException:无效索引8,大小为8
- 4. java.lang.IndexOutOfBoundsException:无效索引50,大小为50
- 5. java.lang.IndexOutOfBoundsException:索引5无效,大小为5
- 6. java.lang.IndexOutOfBoundsException:索引1无效,大小为1
- 7. java.lang.IndexOutOfBoundsException:索引15无效,大小为15
- 8. java.lang.IndexOutOfBoundsException:索引11无效,大小为11
- 9. java.lang.IndexOutOfBoundsException:索引0无效,大小为0
- 10. java.lang.IndexOutOfBoundsException:索引20无效,大小为20
- 11. 无法暂停活动,java.lang.IndexOutOfBoundsException:无效索引0,大小为0
- 12. java.lang.IndexOutOfBoundsException:索引无效
- 13. 自定义listview java.lang.IndexOutOfBoundsException:索引1无效,大小为0
- 14. 如何解决java.lang.IndexOutOfBoundsException:索引0无效,大小为0?
- 15. Android java.lang.IndexOutOfBoundsException:索引1无效,大小为1
- 16. 请帮助:java.lang.IndexOutOfBoundsException:索引0无效,大小为0
- 17. java.lang.IndexOutOfBoundsException:无效的索引0,大小为0
- 18. ArrayList错误:java.lang.IndexOutOfBoundsException:无效索引26,大小为26
- 19. 错误:java.lang.IndexOutOfBoundsException:索引2无效,大小为2
- 20. java.lang.IndexOutOfBoundsException:索引:0,大小:0?
- 21. java.lang.IndexOutOfBoundsException:索引:0,大小:0
- 22. java.lang.IndexOutOfBoundsException:索引:xx,大小:xx
- 23. java.lang.IndexOutOfBoundsException:索引:1,大小:1
- 24. valgrind无效的读取大小为8
- 25. 无效的读取大小为8
- 26. Valgrind:无效的读写大小为8
- 27. java.lang.IndexOutOfBoundsException:无效指数5,大小为4
- 28. 无效的读取大小8,无效的写入大小8(Valgrind)
- 29. java.lang.IndexOutOfBoundsException:无效索引2,尺寸为1
- 30. java.lang.IndexOutOfBoundsException:无效索引2,尺寸为2
哎对不起......我错误地删除了=号...在我的代码中,我已经删除它,但我得到了错误..我可以告诉我其他答案 – Google
好吧,'position'的值是多少? ? – MByD
我在列表视图中添加数据,所以位置是列表视图position..when用户单击任何列表视图项目的位置值越来越和数据添加在该位置 – Google