ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 57 - Associate Android Developer discussion

Report
Export

If you added to your build.gradle file a room.schemaLocation:

android { defaultConfig { javaCompileOptions { annotationProcessorOptions {

arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]

}

}

}}

Then, you build your app or module.

As a result you got a json file, with such path to it:

app/schemas/your_app_package/db_package/DbClass/DB_VERSION.json

What are the correct statements about this file? (Choose all that apply.)

A.
It's a file with Room-exported schema
Answers
A.
It's a file with Room-exported schema
B.
Main JSONObject in this file usually should contain a number "formatVersion" and a JSONObject "database"
Answers
B.
Main JSONObject in this file usually should contain a number "formatVersion" and a JSONObject "database"
C.
The JSONObject "database" in this file usually should contain such objects, like "entities", "views", "setupQueries", ets.
Answers
C.
The JSONObject "database" in this file usually should contain such objects, like "entities", "views", "setupQueries", ets.
Suggested answer: A, B, C

Explanation:

Exported schema file example:

{

"formatVersion": 1,

"database": {

"version": 1,

"identityHash": "d90c93040756d2b94a178d5555555555",

"entities": [

{

"tableName": "tea_table",

"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT, `type`

TEXT, `origin` TEXT, `steep_times` INTEGER,

`Description` TEXT, `ingredients` TEXT, `cafeinLevel` TEXT, `favorite` INTEGER)",

"fields": [

{

"fieldPath": "mId",

"columnName": "id",

"affinity": "INTEGER",

"notNull": true

},

{

"fieldPath": "mName",

"columnName": "name",

"affinity": "TEXT",

"notNull": false

},

{

"fieldPath": "mType",

"columnName": "type",

"affinity": "TEXT",

"notNull": false

},

{

"fieldPath": "mOrigin",

"columnName": "origin",

"affinity": "TEXT",

"notNull": false

},

{

"fieldPath": "mSteepTimeMs",

"columnName": "steep_times",

"affinity": "INTEGER",

"notNull": false

},

{

"fieldPath": "mDescription",

"columnName": "Description",

"affinity": "TEXT",

"notNull": false

},

{

"fieldPath": "mIngredients",

"columnName": "ingredients",

"affinity": "TEXT",

"notNull": false

},

{

"fieldPath": "mCaffeineLevel",

"columnName": "cafeinLevel",

"affinity": "TEXT",

"notNull": false

},

{

"fieldPath": "mFavorite",

"columnName": "favorite",

"affinity": "INTEGER",

"notNull": false

}

],

"primaryKey": {

"columnNames": [

"id"

],

"autoGenerate": true

},

"indices": [],

"foreignKeys": []

}

],

"views": [],

"setupQueries": [

"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",

"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'd90c93040756d2b94a178d5555555555')"

]

}

}

asked 18/09/2024
mohammed zakir
38 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first