Questions tagged [android-room]

For questions related to Android Room Persistence Library (which is a part of Android Architecture Components)

Room provides an abstraction layer over SQLite to allow fluent database access while harnessing the full power of SQLite.

6786 questions
2
votes
1 answer

Does Room android library come with in built pro-guard rules

I have an android app which is using Room library. I am not using @ColumnInfo. I built the release version of app with R8 without any pro guard rules for Room. My app works fine and db operations are working fine in release apk. my question…
Nitin Verma
  • 485
  • 4
  • 19
2
votes
1 answer

problem with creating type converter for room database

hey guys I'm trying to make a database with room and I have a data class as Entity Like this: @Entity(tableName = "forecast") data class WeatherForecastEntity( @PrimaryKey(autoGenerate = false) val id:Int?, val city:String?, val…
Omid
  • 25
  • 6
2
votes
2 answers

LazyColumn notify about modification of item

I have a composable function that looks something like this: @Composable fun listScreen(context: Context, owner: ViewModelStoreOwner) { val repository = xRepository(getAppDatabase(context).xDao() val listData by…
2
votes
1 answer

How to make database for Vocabulary list app with multiple languages like google translate one?

I am working on a vocabulary list app and let's consider that my app has 2 inputs for words in multiple languages. for example, user native language is Korean and wants to learn English, so he/she will choose (Korean/English) from app setting, learn…
Morteza
  • 129
  • 1
  • 12
2
votes
1 answer

Get vararg parameter size in Room Query

Say I have a DB with two main entities (Song and Tag) and a many-to-many relationship between them. Using Room, I want to query the Songs that have a series of Tags (all of them) by their names. So, given this example data in the cross ref table…
Mario MG
  • 364
  • 2
  • 13
2
votes
1 answer

How do I setup Android Room Foreign Keys in a Join table accept "zero" values?

Problem: With Android Room, I'm receiving an foreign key constraint error on a join table when entering zero (0). I'm still trying to learn Android Room so I'm sure I have overlooked something in the documentation and tutorials. What I have tried: I…
svstackoverflow
  • 665
  • 6
  • 19
2
votes
0 answers

java.lang.IllegalStateException: Illegal connection pointer 1 when testing room dao inside workmanager

I am trying to test my viewmodel, which uses workmanagers to get data. Inside these workmanagers, a room database is used to insert the data and then later get the data. My problem is, that I am always getting the above error: Error Exception in…
Andrew
  • 4,264
  • 1
  • 21
  • 65
2
votes
1 answer

Save a Room Database file in Firebase

I have been working on an Android application that populates a Google Map with markers from a Room Database and all user data is stored in a Firebase Realtime Database. The application first copies the Room Database from the assets folder, so all…
2
votes
1 answer

Issue Prepopulate Room Database - Database Inspector empty

I am new to Android development and I am trying to develop a very simple app. I want to create a prepopulated database which has one table . The table is about users and it has only three columns id, name , and profession. The only usage of the…
2
votes
1 answer

error: [Dagger/DependencyCycle] Found a dependency cycle error after using ActivityRetainedScoped

I am working on app that uses MVVM, Room and dagger hilt, I have implemented first part that handle server response, remote DataSource, viewmodel and all this stuff, and it's worked fine, but after I implemented the database module, I got this error…
Dr Mido
  • 2,414
  • 4
  • 32
  • 72
2
votes
2 answers

How can I groupby and sum items from a list in Kotlin

I have a list of dataClass OrderInProgress and I need to sum the prices of similar products and count them to return a list of CartDetail, similar to the query from room database. How can I do it? @Entity(tableName = "order_in_progress") data class…
2
votes
1 answer

Many To Many Relationship (IDs in complex data) Android Room

I want to achieve a many to many relationship with this tow data classes Member and Team since the team can have several members and the member can be in several teams The Member Class have a reference to the teams IDs as a key in Map data class…
2
votes
1 answer

Adding a 1 to Many relationship android Room Database?

I am having a hard time trying to figure out how to add a one to many relationship in my database. The Book entity needs to hold many Counts. When I tried it, I got an error that says: E/AndroidRuntime: FATAL EXCEPTION: main Process:…
2
votes
0 answers

How to transform/update one flow depending on another flow?

I have a two flows. One is a list of products updated by network calls and the second flow is a list of products read from a local SQLite database (using Room). Storefront flow Get all products --- Network ---\ Search products --- Network -------…
clamentjohn
  • 3,417
  • 2
  • 18
  • 42
2
votes
2 answers

Query one to many relationship Android Room

I have a one to many relationship. One Parent can hold many Child entities. The children have the property date, which is of type Instant. I have made a class which combines these two entities: data class Combined( @Embedded val parent: Parent, …