如果是这样的三级联通
https://user-images.githubusercontent.com/9543572/33469218-69fc49bc-d69c-11e7-803a-ccd385e97246.png
#那代码这块就有问题了:
public int[] getCurrentItems() {
int[] currentItems = new int[3];
currentItems[0] = wv_option1.getCurrentItem();
if (mOptions2Items!=null&&mOptions2Items.size()>0){//非空判断
currentItems[1] = wv_option2.getCurrentItem()>(mOptions2Items.get(currentItems[0]).size()-1)?0:wv_option2.getCurrentItem();
// mOptions2Items.get(currentItems[0]).size()-1 这个位置肯定越界
}else {
currentItems[1] = wv_option2.getCurrentItem();
}
if (mOptions3Items!=null&&mOptions3Items.size()>0){//非空判断
currentItems[2] = wv_option3.getCurrentItem()>(mOptions3Items.get(currentItems[0]).get(currentItems[1]).size()-1)?0:wv_option3.getCurrentItem();
}else {
currentItems[2] = wv_option3.getCurrentItem();
}
return currentItems;
}
1条答案
按热度按时间kxkpmulp1#
你这getCurrtentItem方法....