Questions tagged [room]

The Room persistence library provides an abstraction layer over the existing persistance layer (e.g. SQLite) to allow for more robust database access. The library helps you create a cache of your app's data on a device that's running your app. This tag implies you are using android, so maybe it's more useful to use it along with the tag for sqlite or whatever database you are using.

The Room persistence library for provides an abstraction layer over the existing persistance layer (e.g. ) to allow for more robust database access.

This library helps you create a cache of your app's data on a device that's running your app, keeping you from querying the actual database every single time.

Useful links

28 questions
3
votes
1 answer

Android Paging 3 library - for paging data from Room database, flow becomes empty on data change

I am trying to use android Paging 3 (version 3.0.0-SNAPSHOT) for paging data from Room database(no remote data source). Initially the page loads data successfully , but when a new "Entry" is added to database and I return to this page,collectLatest…
Nabzi
  • 1,823
  • 1
  • 16
  • 26
3
votes
3 answers

Room DB: java.lang.reflect.InvocationTargetException

I am implementing Room database in my new app. When setting up the database I get this error: * What went wrong: Execution failed for task ':app:kaptStandardDebugKotlin'. > A failure occurred while executing…
Sermilion
  • 1,920
  • 3
  • 35
  • 54
2
votes
1 answer

Add to favorite using room Database

I'm referring this tutorial ==> https://uniqueandrocode.com/add-to-favourites-and-display-favourites-in-recyclerview/ in my project I have bottom navigation...I am trying to add favourites in the first tab and displaying favourites in the second tab…
IRON MAN
  • 191
  • 3
  • 18
1
vote
1 answer

Kotlin andoid pre poluate data base

I am trying to build a really simple db to store the score of a Hangman game. I built an entity : @Entity(tableName = "scores") data class DBScore( @PrimaryKey var pseudo: String = "", var score: Int = 0 ) { } //Conversion method to go from DB…
Quentin M
  • 171
  • 2
  • 11
1
vote
0 answers

Change database room to realm

i have to work with a new app, that will use realm, the problem is that when have to up to play store the old app have room database. Do you believe, if it can have a problem with the database change?. Thanks for the help Note: i do not have to save…
Carlos
  • 26
  • 3
1
vote
1 answer

Android Room library conflict with Requery Sqlite library

I have a big project already in use, there are many(hundreds of) classes. I want to add a feature like I want to write into SQL database of the phone. And I want to use Android Room library. I am doing everything fine according to the documentation…
khamidjon
  • 131
  • 2
  • 6
1
vote
0 answers

Delete Or update query- room . android

This is My Code : @Delete fun deleteItemFfromCart(model: CartTable) @Query("UPDATE CART SET amount = amount-1 WHERE id = :id") fun updateForDelete(id: Int) : Int @Transaction fun deleteOrupdat(model: CartTable) { …
Bahador Eslami
  • 372
  • 2
  • 13
1
vote
0 answers

Query in DAO is always returns null eventhough data exists in Database in Android-Room-LiveData-Fragments

my database class is public abstract class MyDatabase extends RoomDatabase { private static MyDatabase instance; public abstract DataAccess dataAccess(); public static MyDatabase getInstance(final Context context) { if(instance == null) { …
1
vote
1 answer

How to create recyclerview adapter for one to many relationship in android room

Hello guys i need real help over here my whole app depends on that. I'm trying to create one to many relationship between 2 entities in android room database. I want to know how how can i extract the data of both entities that i can display the name…
1
vote
1 answer

How to create a Room Entity using nested class model?

I want to use a nested class model for my Room table but when I use it and annotate the inner classes with @Embedded I was given a compile error like this: Entities and POJOs must have a usable public constructor. You can have an empty constructor…
Mohammad Mirdar
  • 56
  • 1
  • 11
1
vote
2 answers

RecyclerView sets all the items when single data changed in database

I am using LiveData to fetch 30 items from the database like this: @Query("SELECT * FROM table ORDER BY id DESC LIMIT 30") fun getLast30(): LiveData> Every recycler view item has a like button and I have an interface in the…
1
vote
1 answer

Pre-Designed Hololens Application for a specific room using Unity

I'm trying to develop an app for the Hololens 1 using Unity. What I want to archive is providing a pre-designed experience to users for a specific room (like a specific room in a museum). My idea is, that I scan the room with the Hololens, using the…
iMax
  • 31
  • 1
1
vote
2 answers

How to use ExecutorService with Android Room?

I am using ExecutorService with Android Room to avoid multiple in insetAsyncTasks. I was using Debanjan example from this post: link but I modified it a bit. Problem is that I don't get any exception but nothing is…
Krkec
  • 121
  • 1
  • 4
  • 14
0
votes
0 answers

Room - How to set nullable Foreign Key

In my Kotlin Android codebase I have the following 2 entities.. @Entity( tableName = ModuleConfiguration.tableName, primaryKeys = [ModuleConfiguration.COL_ID], foreignKeys = arrayOf( ForeignKey( entity = Module::class, …
AbdulMueed
  • 1,327
  • 12
  • 19
0
votes
1 answer

Is a good practice to extend a Room Entity and use the same DAO and Repository?

I wanna create two entities with the same fields and I saw that I can extend a entity to inherits fields, I'd like to know if it's a good practice to do it and if is there any problem to use one single DAO and Repository to these entities. Entity…
1
2