Some time after installing the int matrix, int[][] Matrix = new int[4][4]I cannot load it into firebase mDatabase.child("room_1").setValue(Matrix);, because arrays are not supported. The reason I use int[][]is the ability to add integers using Matrix[2][3] += 1
What data types are compatible with firebase and can handle these types of additions? Thank you
I could not get it to work the way I wanted, with lists or Long, so I used int matrix[][]and updated db with setValue(matrix[index][index2])one on one.
In order to get the database in the matrix, I used two nested loops that check each value and put it in the matrix. The next function gets the object
public void SyncWDB(Object dbValue) {
ArrayList aList = (ArrayList) dbValue;
int e = 0;
int i = 0;
while (e < 5) {
ArrayList temp = (ArrayList) aList.get(e);
while (i < 4) {
Long temp2 = Long.parseLong(String.valueOf(temp.get(i)));
int temp3 = temp2.intValue();
Matrix[e][i] = temp3;
i++;
}
i = 0;
e++;
}
}