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

How to set One to many relation in android room DB in kotlin

I have two tables. First table is as below @Entity data class GramPanchayatSurveyEntity( @PrimaryKey var gpCode: Int, var distCode: Int, var locationTypeCode: Int, var location: String, var latitude: String, var…
userVani
  • 47
  • 4
2
votes
1 answer

RoomDataBase Empty in device file explorer

When I look at the databases file in device file explorer the folder is empty. I have tried to fix the problem myself but I haven't been able to since I'm quite new to android development. This is all the code that has been written so far: Main…
Clivityy
  • 123
  • 10
2
votes
1 answer

resolve build failure in android studio - while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkActio

I have imported the project into android studio. I am the only one getting this error. This is the headline of the error A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction Here is…
2
votes
2 answers

Room returns java.lang.Object for all my suspended Dao functions

I have a project with a Room database, which was working fine, and now for some reason I can't find out, it isn't anymore. I am getting the following error when compiling: C:\(...)\FlightDao.java:18: error: Not sure how to convert a Cursor to this…
Joozd
  • 501
  • 2
  • 14
2
votes
2 answers

RoomDB: Migration without schema changes, I just want to drop the old Database and create from asset

My app doesn't need to keep user's custom data yet, all Data in Database is prepopulated via createFromAsset(). Now I want to make a version 2 that, when installed in device that already runs version 1, just drop all the data and feed it with…
SebasSBM
  • 860
  • 2
  • 8
  • 32
2
votes
1 answer

LazyRow inside LazyColumn call recompose every time

Hi I have an object with a list of other objects. I need to show a list of the first one, and inside each object show a horizontal list with the other objects. I have these object stored in local database by room. These objects are related with a…
2
votes
1 answer

Insert a list of objects into my room database at once, and the order of objects is changed

I tried to insert a list of objects from my legacy litepal database into my room database, and when I retrieved them from my room database, I found the order of my objects is no longer the same as that of my old list. Below is my code: // litepal is…
Fever
  • 157
  • 2
  • 9
2
votes
1 answer

Using kotlin.UByte for Room Entity not working

I want to store the following dataclass in my room database. Somehow, I do not succeed: @Entity data class UInt8( @PrimaryKey(autoGenerate = true) var key: Int, var name: String = "uint8-test", var value: UByte = 0.toUByte(), var…
agentsmith
  • 1,226
  • 1
  • 14
  • 27
2
votes
1 answer

Jetpack Compose: Update Icon based on Room database query result

My app displays an object queried with Retrofit that a user can save to the local Room database by tapping an icon. The icon itself works, but if I restart the app the icon's boolean value is set to false even though the object is saved in the…
2
votes
0 answers

How to add programmatically generated imageviews to room database

How can I add multiple imageviews generated programmatically from linearlayout to room database. I have used byte for it but I can only store one image. I want to store all images in the same row ImageView imageview = new ImageView(this); …
2
votes
1 answer

Get tree of ancestors from a SQLite table with Room and Flows

This is very tricky for me because I don't know if it can be done with a SQLite query or by recursively calling some function. It gets complicated because I also use Flow and LiveData with ViewModel Basically, my entity looks like this @Entity( …
alexmro
  • 563
  • 4
  • 16
2
votes
1 answer

(Anrdoid) How to prepopulate the Room database

I made a screen like the current image. Data such as A, B, C.. are currently being set by getting from the strings.xml resource file. I am now going to use Room DB instead of strings.xml and I want to get these data from Room. To do this, we need…
ybybyb
  • 1,385
  • 1
  • 12
  • 33
2
votes
1 answer

Android custom keyboard suggestions

I am building a custom keyboard for android, the one that atleast supports autocomplete suggestions. To achieve this, I am storing every word that user types (not password fields) in a Room database table which has a simple model, the word and its…
2
votes
1 answer

(Android) How to match child ID to parent in one-to-many relationship

I'm working on an image-like, one-to-many database. To explain the flow of functions, WorkoutSetInfo is added to the list whenever the Add button is pressed. (It is not inserted into DB.) Finally, when the Save button is pressed, the Workout and…
ybybyb
  • 1,385
  • 1
  • 12
  • 33
2
votes
1 answer

Migration in Room with an Android Array of Strings

I have a database in Android with Room from which I have deleted a column. I was doing the migration, and I saw that it was not as simple as doing a DROP of the deleted column. Then I have seen that I have to take a series of steps, creating a…
Ludiras
  • 338
  • 3
  • 20