Home » Android » android – Does Room database support boolean variables in entity?

android – Does Room database support boolean variables in entity?

Posted by: admin June 15, 2020 Leave a comment

Questions:

I know that sqlite does not support Boolean and we need to use int columns to mimic the behavior of Boolean . But does Room support Boolean ? What if have a Boolean in my entity ? Will it work as expected?

How to&Answers:

Yes it does. When you store boolean using room, it automatically stores 1 for true and 0 for false.

And same case while reading. It converts 1 or 0 to true/ false respectively.