Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android, cursor returning boolean value?

Tags:

android

sqlite

Can an Android Cursor return a boolean value? I've looked at the docs and there was no info on it?

If not - then is there an alternative way to get a boolean value from a SQLite table?

like image 872
Jonathan Avatar asked Jul 29 '11 12:07

Jonathan


2 Answers

The android implementation of SQLite3 doesn't properly support boolean values. You will need to use integers set to 0 or 1 and write some code to convert that to a boolean e.g.

int x = cursor.getInt(...);
return x == 1;
like image 197
ScouseChris Avatar answered Sep 28 '22 13:09

ScouseChris


Use enum type with values 'Y' and 'N' to represent the boolean value

like image 44
shib Avatar answered Sep 28 '22 11:09

shib