In my Android Applicatio I have an Array of Strings from whom I want to remove Strings.
List<String> categoryList = new ArrayList<String>(Arrays.asList(dishCategory));
for (int i = 0; i < dishCategory.length; i++) {
if (dishCategory[i].equals("Beilagen")) {
categoryList.remove(i);
}
String[] dishCategory = categoryList.toArray(new String[categoryList.size()]);
}
But when I try it it givees:
FATAL EXCEPTION: main
Process: de.hswt.fuca, PID: 19818
java.lang.IndexOutOfBoundsException: Invalid index 14, size is 13
at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
at java.util.ArrayList.remove(ArrayList.java:403)