Newest 'android-room' Questions - Stack Overflow

Questions tagged [android-room]

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

0
votes
1answer
24 views

How to configure notification for user with specific date then store it in room database

I'm developing a notification for appointment, and I want to store it in my database. I have a class "Notification" and I have the appointment interface. So, what I need is when the switch is checked ...
0
votes
0answers
17 views

Room: Getting an entity directly by using foreignKeys?

I'm working on an Android project, and I'm using Room for database persistence. I have an entity ComputerEntity which has a feild String refComputer, which is a foreign key to RefComputerEntity. In ...
2
votes
0answers
28 views

LiveData not calling Observer on Adding new entry to Room DB

I am using Room DB to store user set Price Alerts. The Alerts list is shown in a Fragment with a button which launches new activity to add new entry. When I add a new entry and go back to fragment, ...
0
votes
1answer
24 views

Non connection with database?

I am newbie to Android Studio and i am creating a project with login and registration. I am using room technology and yet have searched on the Internet i couldn't find why i can't access my database. ...
0
votes
1answer
17 views

How to run same function synchronously and asynchronously

I am using Room and RxJava2 in Android application. I have a scenario inwhich I want to same function to run synchronously at some point and to run asynchronously on other place. Below is the function:...
1
vote
0answers
9 views

Recyclerview not updating ROOM sqlite data

I am using ROOM database in order to add and get data from database, and using RecyclerView to show the data. The problem here is after certain updates recycler view is not showing the updated data in ...
0
votes
0answers
32 views

Room query returns 0 rows?

I have 2 entity classes: @Entity(tableName = "games") public class Game { @PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") private int gameId; @ColumnInfo(name = "category")...
0
votes
1answer
22 views

How to delete multiple entities/objects in Room persistance

I use a swipe to delete my object's that are inside my RecyclerView. So if I swipe to the right I delete it first out of my RecyclerView after the swipe the user has to press my trashcan to completely ...
0
votes
1answer
31 views

Chain a RxJava observable to udpate/create an entry in Room database

I want a way to search and update an existing entry in Room with RxJava. If there's no record it should create a new one. For example, lets say I have the following queries: @Insert Single<Long&...
1
vote
1answer
19 views

Levenshtein distance in ROOM database

I have created an application that using some predefined dictionaries (for different languages) to show user matching word (each word atm is search by normalised value e.g. "owi" -> "lowic" and ...
0
votes
0answers
19 views

How to perform long running Databse operation using RxJava2 till all the task executed and data inserted into Database in Android?

I'm new in RxJava. I have currently executed three API calls parallel which is independent of each other via Retrofit using Single.Zip Operator. On getting a successful response of all three API calls,...
0
votes
1answer
21 views

Room - Migration didn't properly - Android

I am using from Room and i am using from addMigrations from 1 to 2 but say me: Expected: TableInfo{name='tblCourseContentList', columns={downloadPackageSize=Column{name='downloadPackageSize', type='...
0
votes
0answers
17 views

Room does not support boolean operators in Full Text Search (FTS4 / FTS)

I've spent a day trying to figure out why Room fails to process a query containing the boolean operators AND and NOT and have not successfully been able to get it to work. Take the following query: ...
2
votes
2answers
37 views

Room db with many to many relations : returns single entry on querying for filtered data

I have 3 enitities Person, PersonTagRelation and Tag : Person is related to a tag via many to many relation. I also have a single dao for having multiple functions for querying db. Most of the things ...
0
votes
0answers
10 views

Foreign Key Constraint RESTRICT not being caught

I am trying to catch the foreign key constraint exception in Android using Room. I have been unable to catch this run time exception using specific exceptions, SQLiteConstraintException to the most ...
0
votes
0answers
9 views

Is it possible to get all values exists in specific field in Room Db?

I have a Room DB with a list of object, every object contain field with i would like to filter by . The Idea that seems to me as the best option is to get all unique values for this field than to ...
0
votes
0answers
17 views

How to fix “Cannot provide null context for the database” - Android Room

I'm trying to build a Room Database but it says that Context is null even tho I tried the same classes in different application and it works as intended. @Database(entities = {City.class, User.class}...
0
votes
1answer
9 views

Database Dependent (Room) Conditional startDestination Android Navigation

I'm setting a conditional startDestination, as e.g. seen here: /a/51961843/393607 The problem: The condition should depend on a room query. This query can't be run on the ...
0
votes
1answer
25 views

Trying to catch a SQLiteConstraintException in Android Room and display an alert

I am using a foreign key constraint of onDelete RESTRICT so that when the parent has children with the FK it cannot be deleted. This is working correctly. However I need to alert the user when the ...
-1
votes
0answers
23 views

update the room version from 2.0.0-rc01 to 2.1.0,kapt build failed

when i update the android room version from 2.0.0-rc01 to 2.1.0,gradle build failed,and i don't know the reason,the code in 2.0.0-rc01 is work fine,this is the build output,i can not find more error ...
0
votes
0answers
30 views

Sync Room Database in Google Drive?

I am trying to sync room database with google drive and I have followed this document https://medium.com/glucosio-project/backup-restore-a-realm-database-on-google-drive-with-drive-api-c238515a5975 ...
1
vote
1answer
37 views

Returning a count of items from Room DB

I am trying to prevent the deletion of a parent from the Room DB if it has children associated by foreign key. I am working on a degree tracker. If there are courses for a term, the term cannot be ...
1
vote
1answer
46 views

How to insert image in room database?

I am using room persistence library for my android application, I have to insert image in my database. I have an Entity Picture and an Entity Folder . So now, my question is how to save picture and ...
0
votes
0answers
33 views

How to change search query parameter using ViewModel and Rx Observable in Room database

I have the query @Query("SELECT * FROM call") fun load(): DataSource.Factory<Int, Call> Which I use as follows class CallViewModel : ViewModel() { fun calls(context: Context): Observable&...
0
votes
1answer
35 views

Type converter for List of objects in room db

I want to insert in my room database, a list of employees for every Task. I am getting this error : Cannot figure out how to save this field into database. You can consider adding a type ...
0
votes
0answers
22 views

Do database query in Application or SplashActivity to set global variables [PERFORMANCE]

I want to know is it better, for the performance, todo a db query in the start Application class or in the splash Activity? I know that the start from the app would be slower when I do to much ...
0
votes
2answers
39 views

error: Entities and Pojos must have a usable public constructor. Kotlin

I have the following class: package com.mikhailovskii.trakttv.data.entity import androidx.room.Entity import androidx.room.Ignore import androidx.room.PrimaryKey import androidx.room.TypeConverters ...
0
votes
4answers
33 views

How to display a Toast only if a row is been deleted in ROOM Database?

I want to display a Toast only if a row is Successfully been deleted from ROOM database and also when deletion is not successful. Row is successfully being deleted but i want to display Toast on both ...
0
votes
0answers
21 views

How to model data when using Room

I am reading up on Room and the way it handles relationships between entities is both understandable, but confusing. I cannot wrap my head around what a "proper" data model should be to make Room ...
1
vote
0answers
15 views

Testing Room as JUnit Test Not AndroidTest

Trying to test room migration using the MigrationTestHelper class and Robolectric. We want it as a JUnit test because our CI environment cannot fire up an emulator. (Please no answers with CI fixes ...
0
votes
0answers
12 views

Android Room concurrent reads with Coroutines

I am using Room with coroutines to store/retrieve data. From another post I saw that you could technically have unlimited number of retrievals from the database at the same time. Currently, I am ...
1
vote
0answers
21 views

Not able to access the room database from test cases - Android

I am getting an error while performing the database operation. In my project when I try to access deleteAll() from Dao class ie.e,AuthenticationDaoof Room Database from my test cases I am getting ...
0
votes
1answer
18 views

Room database scroll to a particular position using Recycler View

I am using Room data base to fetch the data from the data base. Recyclerview I want to scroll to a particular position in recyclerview. I have already tried list.setNestedScrollingEnabled(true) ...
2
votes
3answers
48 views

Room select expression

I need to create a not so simple Sql select query. Something like this: @Query("$SELECT_FROM $PRODUCT_TRANSACTION_TABLE WHERE write_status == ($SALE || $AUDIT)") fun ...
0
votes
0answers
9 views

how to handle exceptions when using Room with LiveData

when using android-room with LiveData together, it sometimes throw Exeptions such as SQLiteCantOpenDatabaseException & SQLiteFullException, but I can find a chance to catch the excpetions as the ...
0
votes
0answers
16 views

Unable to delete first and last record of table when using @Delete annotation of Room Android

I am using Room for Database and code for deletion of row working properly when delete last record of table but not working when i am deleting middle of first record. DAO.class @Delete void ...
2
votes
0answers
37 views

Android - Migrating to Room Database

I need to migrate from Sqlite database to room in my application, but before migrating i have some doubts regrading room database i have searched through many sites but i have not satisfied with the ...
0
votes
0answers
13 views

custom OnConflictStrategy using Room DB

I'd like to set my own conflict columns not default primary key (just an auto increment integer in my case). So my table is: @Entity(tableName = "users_tab") data class User( @PrimaryKey(...
0
votes
0answers
26 views

Android Room - Nested embedded relations

I am trying to create a class A-With-B where B is a List<> of B-With-C. It may be important information: Classes A and B have a many to many relation, so there is an association table in between. ...
0
votes
1answer
26 views

How to use Android Room to store data records

I want to store team information in an Android Room database. The information contains team name, players, batting, fielding, and bowling statistics. These are my requirements: Team Names have to ...
0
votes
0answers
76 views

Android Room database file is invalid file format in DB browser

I am going to data/data/myPackage in emulator and download these three files about my apps database : But when i import it to DB browser i faced with this error : I think the problem is about ...
1
vote
2answers
60 views

Create Android Room entity classes from DB file

I have a database file and queries. Using this I want to generate Room Entities. Is there any tool available using which I can automatically generate room entities?
0
votes
0answers
46 views

Get value of live data

I am using Room, ViewModel and two-way databinding. In this simple example I need to select data from database and validate it. If data are valid then expose it to databinding. In the other case I ...
0
votes
0answers
19 views

Getting error while accessing the room database in test cases - Android

I am using room database in my app. I have Login feature in my app, where after taking userId & password, on click of Login button I am calling API and storing the response data in room database ...
-1
votes
1answer
27 views

how to synchronize Room data with Cloud Firestore?

I want to be sure that I can save data offline. How to synchronize data in Room with Firestore? When something inserted to Room Firestore must be updated as well.
0
votes
0answers
23 views

Room SQLite select statement with strftime does not return any result

I have an android app with a database based on the room library. public class Entry { public Entry(int cat_id, Date date, float value, String comment) { this.date = date; this....
0
votes
1answer
29 views

Is it possible to write a “suspend” function in a Room @DAO which returns LiveData? [duplicate]

I'm trying to convert all methods of my @Dao objects to be suspendable for use from Kotlin coroutines. When I add the suspend modifier to working function definitions and try to Build in Android ...
0
votes
1answer
24 views

How to save recorded sound in the Room database?

I'm trying to make sound recorder app and I want to use the Room database in this small project to make list of recorded sounds. But how to save recorded sound in that database? Does anyone have some ...
-3
votes
0answers
36 views

My App Crashes when I go to a recycler view activity [duplicate]

I'm developing an entry form app that has a main menu, a data input form and a display form to show all the items added into the data base, I'm using the android Room library. My app crashes when I ...
0
votes
0answers
26 views

Completable doesn't call onComplete or onError method in Subscribe

I have the following code: mCompositeDisposable.add(Observable.just(bundle) .subscribeOn(Schedulers.io()) .doOnSubscribe(disposable -> mView.showLoadingIndicator(true)) ...