I keep getting a NullPointerException at (see below). Everything works fine in C#, but in android it breaks?
arrDBNumbers is full and code is supposed to run through an
Because just writing
Integer[][] arrFreq = new Integer[49][2];
means you have initialized the array with all null
elements because it is an array of Integer
Objects and Object's default value will be null reference.
Hence,
arrFreq[i][1]++; // trying null++;
gives NullPointerException
.
This wouldn't have been the case if you had used an array of primitives, which will default to an array of 0
s.
int[][] arrFreq = new int[49][2];
Integer is a container for int, in your case you have lots of null objects. if you use int instead it will work as you expect.