How can I obtain the value of a boolean field in an SQLite database on Android?
I usually use getString()
, getInt()
, etc. to get the values of my fields, but there does not seem to be a getBoolean()
method.
It is:
boolean value = cursor.getInt(boolean_column_index) > 0;
There is no bool data type in SQLite. Use an int that you fix to 0 or 1 to achieve that effect. See the datatypes reference on SQLite 3.0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With