ArrayAdapter and ListView - ArrayIndexOutOfBoundsException

夙愿已清 提交于 2019-12-04 07:46:08

What version of Android are you running? From what I can tell your Adapter is returning the wrong count from getViewTypeCount() (or you are changing the view type count dynamically which is a big mistake.)

Brian

In addition to what Romain said, it seems to be important that the largest view type is smaller than the view type count.

I had two view types defined (for what ever reason) with 1 and 2 and returned 2 in getViewTypeCount() which gave me the same exception as above. Re-indexing the types to 0 and 1 fixed the issue.

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