Android / Java rare and seemingly impossible exception causing force close
- by Guzba
Hello all, I have an interesting problem being reported to me from an android application I have published. I have a two-dimensional array that I am iterating through using two for loops like so:
for (int i = 0; i < arr.length; ++i)
{
for (int j = 0; j < arr[i].length; ++j)
{
if (arr[i][j] != 0)
// does stuff
}
}
The problem is, somehow arr[i][j] != 0 is throwing an ArrayIndexOutOfBoundsException. But very rarely. I have thousands of people use the app on a daily basis and get maybe twenty force close reports.
Is this something I can't avoid, maybe a problem with the phones memory, etc. or is there something I can do that I haven't thought of yet? Thanks.