Questions tagged [roomdb]
20 questions
2
votes
1 answer
How can I resolve the error when using Kotlin Flow and deleting data in Android RoomDB?
I am getting the following error after deleting the RoomDB data:
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String app.zimablue.artbookfragmentversion.model.ArtEntity.getArtName()' on a null object reference
I think…

Mert Parlak
- 23
- 4
1
vote
0 answers
How to count total price from recycler view using roomdb android kotlin?
Excuse me, i just wanna ask about how to count total price from recycler view using roomdb. So, everytime the user click the button add stock, the cart is supposed to be updated. And from the updated cart i can count the total price that came from…

Random Thought
- 11
- 2
1
vote
0 answers
How to refresh android Room database values in kotlin
I am developing an android application project in kotlin. I have room database values with coroutines. After certain time (every 30 minutes), I want to refresh those android Room database, live data values.
Can anyone please help me on how to…

chanthini begam
- 109
- 1
- 11
0
votes
0 answers
Room Database "Unresolved" issue
When i write a code according to other page it gives an error "unresolved reference in RoomSQL"
here are my codes:
@Entity(tableName = "notes")
public class Notes implements Serializable {
@PrimaryKey(autoGenerate = true)
int ID = 0;
…

Nisanur Turan
- 3
- 5
0
votes
0 answers
Textview cannot be updated, except move to another fragment first
Excuse me, I got an error updating textview tv_cart_realprice2 using item.hargaproduk data while in app inspection item.hargaproduk is updated. it cannot updated automatically, it need to move to another fragment than back to the fragment where the…

Random Thought
- 11
- 2
0
votes
0 answers
How to export room database as excel/csv file?
I am developing an app where I want to export the database tables as an excel/csv file.
Here is my current code:
val dbhelper = DBHelper()
val exportDir = File(getExternalStorageDirectory(), "")
if (!exportDir.exists()) {
…

Angel
- 175
- 1
- 3
- 10
0
votes
2 answers
How to combine & wait for multiple getData() DAO calls in Android
I have an app based on MVVM, There are 5 Dao interfaces:
@Dao
interface DataDaoOne {
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertData(classA: ClassA) : Long
@Query("SELECT * FROM class_a")
fun getData() :…

Takshak Rajput
- 119
- 1
- 14
0
votes
0 answers
I want to show the data in the roomDB in the recyclerview, but it is impossible to import the data
Adapter class
package com.example.breakingblock.roomdb
import android.util.Log
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.lifecycle.LiveData
import androidx.recyclerview.widget.RecyclerView
import…

김민서
- 1
0
votes
1 answer
Table is empty when trying to access the database using RoomDB in Android Studio
getAllLandmarks() returns nothing because table is empty as shown in database inspector.
I am trying to set up roomDB in Android Studio and creates googlemap marker by extracting the lang and longitude from the database.
Problem ScreenShot:
What it…

Anonymous01
- 11
- 4
0
votes
0 answers
Set Limit number of data to be inserted in roomDb
I am inserting data in my roomDb table. I want only 10 row to be generated when storing the data in table. if 11th entry comes in table then in FIFO(first in First Out) manner the first entry should get deleted and new data should be added in table…
0
votes
0 answers
Room database custom order by functionality
In a room database if the table has a latitude and longitude column.
How can the return values of a Query be ordered using the ORDER BY statement in the query to show the same order as if I ordered using the function below?
private fun…

Darren
- 74
- 1
- 10
0
votes
0 answers
When does RoomDB insert data into the database? Why is my insert not getting written right away?
The app I'm working on inserts a row in a database and then show it on the UI. Looking at the app, I can see that the row was added since I can see it in the list once the insert is called. By the way I'm using flow in my Dao class and collect it in…

Lance
- 2,774
- 4
- 37
- 57
0
votes
1 answer
NullPointerException on MAX value retrieval from Dao in Room database
From the Room database, I want to get the MAX value for a specific column returned as a Long value, but it throws the NullPointerException error below when I add the very first item into the shopping list. How can I fix…

Raj Narayanan
- 2,443
- 4
- 24
- 43
0
votes
1 answer
How to query room database to get the count of all rows grouped by Level where done = 1
I have a "Users" database table as follows:
Name
Level
Done
Allen
1
0
Diane
1
0
Victor
2
1
Gabriel
3
0
Roger
4
0
Julia
4
1
I want to write a query to return the count of all records, including null values where the value of…

Allison Grut
- 1
- 1
0
votes
0 answers
ROOM DB duplicated entries in list/map through inner join
I have set up tables and entries with room DB. And have trouble properly returning DB Objects according to their relation ships.
To understand it better. This is all part for a location app.
For roomDB I have different Tables with one to Many…

TestiUser
- 1
- 1