Get boolean from database using Android and SQLite Get boolean from database using Android and SQLite sqlite sqlite

Get boolean from database using Android and SQLite


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.


boolean value = (cursor.getInt(boolean_column_index) == 1);