droidquiz and selecting
New ▸ Package and name it
data .
Inside the
data package, you will store all the code related to your Room database
including your entities and data access objects.
Create a new package inside the
data package and name it
model . Inside the
model
package, you will store the data classes that will be converted to entities using
annotations.
The DroidQuiz app will consist of a very simple database with two tables — a
Question table and an
Answer table.
The Question table will have two columns:
•
question_id : A self incrementing
Int
that will act as the primary key.
•
text : A
String
that represents the text of the question.
The Answer table will have four columns:
•
answer_id : The primary key for this table.
•
question_id : A foreign key that references a question in the