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
0 answers

OutOfMemory Error when trying to convert string list to long list using type converter in room db

I am getting the following error when I am using a type converter to convert a string array to long array and saving it into the room database. Fatal Exception: java.lang.OutOfMemoryError: Failed to allocate a 2064 byte allocation with 1782896 free…
2
votes
3 answers

Android room database: get autogenerated id at time of assignment

I have an android database with an entity something like id (autogenerated) string filename 0 cow myFolder/0.mp3 3 sheep myFolder/3.mp3 In other words, I want to use the autogenerated id to be included in a filename once the entity has…
dlw
  • 103
  • 1
  • 8
2
votes
1 answer

Using Android Room, what is the maximum size of a blob and where is this documented?

I'm using Android Room and storing ByteArray data as BLOBs. Above a certain size, an attempt to retrieve a row will fail with the following message: E/CursorWindow: The size of (0, 2) is too big (4194304), so replace the value to NULL and the…
jwillc
  • 63
  • 6
2
votes
1 answer

Room - update entity doesn't update value in the database

I have some spinner with currency names in it. I'd like to update base currency in room db, whenever user select any of the currencies in spinner. I've wrote some functions, but it doesn't work. I've checked it in Database Inspector, and some…
2
votes
1 answer

Room dao cannot resolve table name and method

I'm trying to implement a simple database using Room and Dao, this is what I did My entity: public class Note { @PrimaryKey(autoGenerate = true) private int id; @ColumnInfo(name = "title") private String title; } I have also…
user19856031
2
votes
1 answer

SearchView shows Data.entity.Cantact.@85c7ce6 in Android Studio

In this project that I did, the search view works properly, but as you can see in the picture, the output is like this: output: com.mahdi.roomdatabase.Data.entity.Cantact.@85c7ce6 what's wrong with this codes? enter image Codes: …
2
votes
0 answers

Conditional query getting crash in android

I am using room database in android studio when run query like Select * from table_name it is working but if I apply some conditions like WHERE then false response. The same conditional query run on DB Browser for SQLite then it is working…
2
votes
0 answers

How to attach Room database to a SQLiteDatabase?

I have an old database (connected using SQLiteDatebaseHelper) in my android code, which is pretty legacy and has lots of tables, views, and more. The query is run directly and cursors are parsed. The data in DB is used for rendering an Activity. Now…
vizsatiz
  • 1,933
  • 1
  • 17
  • 36
2
votes
1 answer

How do I prepopulate 2 tables in my room database? (kotlin)

I have 2 db files in asset. I have to prepopulate 2 tables @Database(entities = [Quotes::class, Anime::class], version = 1, exportSchema = true) Here I have tried something but it isn't working @Provides @Singleton fun…
2
votes
1 answer

Error while compution live data and IllegalStateException ROOM Database

I need to use two arraylists in my database. Here is the entity class: @Entity public class User { public int getId() { return id; } @NonNull public ArrayList getValues(){ return values; } @NonNull …
ALiCe P.
  • 231
  • 1
  • 10
2
votes
2 answers

java.lang.RuntimeException: Exception while computing database live data

I learning Room library for creating apps with sqlite database, but I get an error. In the first launching when I add item to DB, it navigate to fragment with RecyclerView and after 1 second my app crashes. Error E/SQLiteQuery: exception: Row too…
Пан Код
  • 35
  • 1
  • 4
2
votes
1 answer

What do @Relation classes mean when creating a one-to-many relationship in Room?

I'm making an Workout log app. One Workout has multiple sets. I want to store this in a one-to-many relationship in Room. In conclusion, I succeeded in saving, but I'm not sure what one class does. All of the other example sample code uses this…
ybybyb
  • 1,385
  • 1
  • 12
  • 33
2
votes
2 answers

Dropping a column with Room AutoMigration

I am trying to drop a column oldColumn from my table EverChangingTable. I bumped the version number in my @Database annotation... I added an AutoMigration with a spec consistent with what the Room error is asking (however the Room error seems to…
Tyler
  • 19,113
  • 19
  • 94
  • 151
2
votes
1 answer

Databases Folder Empty In Device File Explorer-ROOM Database

When the app is ran, no errors occur however, the databases folder in device file explorer is empty. I have tried to fix the issue myself but since I'm new to android studio and kotlin I haven't been able to I just want to ensure the database is…
Clivityy
  • 123
  • 10
2
votes
1 answer

Room database is recreated at app restart

Using Android API 32 and Room 2.4.2 Room database is created like this companion object { @Volatile private var INSTANCE: AppDatabase? = null fun getDatabase(context: Context): AppDatabase { val tempInstance = INSTANCE …
yaugenka
  • 2,602
  • 2
  • 22
  • 41