更新时间:2023-09-07 19:02:52
您code说:
如果输入的字符串长度为0 ...大写字母,然后检查这个词与它启动,但输入的字符串长度为0,为什么你会想这样做这两件事情?
if the input string length is 0 ... uppercase it and then check that the word starts with it, but the input string is length 0 so why would you want to do these two things?
你应该有你的方法的顶部的第一件事是:
The first thing you should have at the top of your method is:
input = autocomplete.getText().toString();
if(input == null || input.isEmpty()) {
return; // user hasn't done anything or has cleared the box
}
修改的
您应该改变你的方法输入变量名,以帮助您:
You should change your method input variable names to help you:
onItemClick(AdapterView<?> parent, View view, int position, long id);
您数组下标越界是在这里,你需要检查你的铸造和你正在做一个拿到就行了。确保它拥有您的项目。
Your array index out of bounds is in here, you need to check what your casting and the list that you are doing a get on. Ensure it holds your items.