I am trying to store a null value into the database but everytime I load the value I get 0.
I declare the field just like “intVal integer"
This is how I retrieve it:
Integer x;
x = cursor.getInt(cursor.getColumnIndexOrThrow(MyDBAdapter.KEY_X));
Is that reliable? or is it undefined?
So it seems to me one cannot save null as an undefined integervalue
Many thanks
From the
getInt()documentation:So, it’s an implementation detail which you shouldn’t rely on.
You can still get the effect you want, though: you simply do the null check before you read the value.