Q:

ArrayList java.lang.ArrayIndexOutOfBoundsException: length=10; index=10

I am getting stumped by this error.  
java.lang.ArrayIndexOutOfBoundsException: length=10; index=10

Below is the code that is causing the exception.  'keys' is an ArrayList.
    for (int i = 0; i < keys.size(); i++) {
        if (values[i] != null) {
            contentValues.put(keys.get(i), String.valueOf(values[i]));
        }
    }

What could be causing this outOfBoundsException?

A:

the error is pretty self explanatory. The index you try to access does not exist. Java uses zero based indexing. Which means that if you have something of size 10, it's indices are 0-9
In your for loop you never check if values[i] can go up to 10; Which apparently can't.
By the looks of it, values[] is of size 10 and keys is bigger.

