android : How is the default value assigned during insert in room

50
February 12, 2019, at 00:20 AM

I am using Room in my app and while testing migrations i did a direct insert ( not using the Entity class )

val values = ContentValues()
    values.put("id","id0")
    values.put("local_id","local_id0")
    values.put("first_name","first_name")
    values.put("last_name","last_name")
    values.put("email","email")

    db.insert("table", SQLiteDatabase.CONFLICT_REPLACE, values)

I have a column named present which is boolean and I am not assigning any value while inserting as its non null. But after insert when i verify it have value true. How is this happening as I understand sqlite assign null by default

from the json file generated:

"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`local_id` TEXT NOT NULL, `id` TEXT, `first_name` TEXT, `last_name` TEXT, `email` TEXT, `present` INTEGER NOT NULL, PRIMARY KEY(`local_id`))"
READ ALSO
How to start new activity from recyclerview?

How to start new activity from recyclerview?

I want to start new activity and also passing JSON data to the new activity when i click an item on the recyclerviewi followed a video in youtube: https://www

95
Drawing rectangles that fill up with gradient depending on the value

Drawing rectangles that fill up with gradient depending on the value

I want to have three separate rectangles that would fill up with gradientDepending on the value X the gradient would be placed differently

75
Android Studio an generates error when creating an apk

Android Studio an generates error when creating an apk

I got the error specified below when I tried to generate the apk of my app in Android Studio ,please help

82
Different screen size issues - how to fix that?

Different screen size issues - how to fix that?

I have some fixed height and width, and margins in my layoutI think it is causing issue when I try to support multiple screen sizes

77