android week 6

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/15

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

16 Terms

1
New cards

What is Room in Android development?

disigned to simplify database access and interaction in Android apps

2
New cards

What are the three main components of Room?

Entities
DAO
Database

3
New cards

What is an entity in Room?

a class that represents a table in the database,

4
New cards

How do you define a primary key in Room?

Use the @PrimaryKey annotation. To auto-generate it, set autoGenerate = true.

5
New cards

What does @ColumnInfo do?

Specifies custom column names when the field name differs from the database column name.

6
New cards

What is the purpose of a DAO in Room?

provides methods to interact with the database

7
New cards

What annotations are used in DAOs?

  • @Insert – Adds new data.

  • @Update – Modifies existing data.

  • @Delete – Removes data.

  • @Query – Executes custom SQL queries.

8
New cards

What is the role of a RoomDatabase class?

It serves as the main access point to the database and provides DAOs.

9
New cards

What is a migration in Room?

is used to update the database schema when the database version changes.

10
New cards

How does Room support reactive programming?

By providing support for LiveData and Flow, which automatically update the UI when data changes.

11
New cards

How does Room support coroutines?

Room allows database operations to be marked as suspend functions, ensuring they run asynchronously.

12
New cards

Why should database operations not be performed on the main thread?

To prevent UI lag and ensure smooth app performance.

13
New cards

How does Room enforce background execution?

By supporting coroutines, LiveData, and Flow to handle database operations off the main thread.

14
New cards

What is a database transaction in Room?

groups multiple database operations to ensure that either all changes are applied or none at all if an operation fails.

15
New cards

How does Room integrate with Jetpack Compose?

It provides reactive data via LiveData and Flow,

16
New cards

What are the key benefits of using Room?

  • Ease of Use

  • Jetpack Integration

  • Thread Safety

  • Reactive Data