Questions tagged [android-database]
General programmatic usage of databases on Android
573
questions
0
votes
1
answer
17
views
How to get sorted data from Room DB on the base of Date/TimeStamp?
I have a class which is containing Data related to different teams. There is a column in db named as "LastMessageAt" and its data type is String.
I am getting this field as String from API ...
0
votes
0
answers
40
views
How get no sent message
How I can get no sent messages?
Where I get all messages from Telephony.Sms.CONTENT_URI, it is good working. But if my message no sent (no many, no radio, etc), I no got in Telephony.Sms.CONTENT_URI.
...
0
votes
1
answer
25
views
Why do time-consuming operations in `lifecycleScope.launch` block the UI thread?
I read list of pages from database and display on RecyclerView. It looks like this:
ViewModel:
@HiltViewModel
class BookDetailViewModel @Inject internal constructor(
savedStateHandle: ...
0
votes
1
answer
36
views
How can I fix this error for view Model? (Occurs when running the program on the emulator)
Error running program on emulator:
2022-06-16 15:38:04.724 12519-12555/com.example.mvvm E/AwareLog:
AtomicFileUtils: readFileLines file not exist:
android.util.AtomicFile@5abc123
2022-06-16 15:38:04....
0
votes
1
answer
33
views
Do I need to show progress when working with a database?
I get data for 50 items, the request is very fast and the progress does not even have time to appear on the screen. During the scroll, when there are 6 elements left, the next 50 are loaded to the end ...
1
vote
0
answers
23
views
Why should I use a ContentProvider with exported=false?
I can't figure out why I should use a ContentProvider with the setting "android:exported=false" in the AndroidManifest.xml. Aren't ContentProviders created to share data between multiple ...
0
votes
1
answer
59
views
Data imported from Database is not set in view
I'm making a screen similar to the image.
The data set in advance is taken from the Room DB and the data is set for each tab.
Each tab is a fragment and displays the data in a RecyclerView.
Each tab ...
-2
votes
2
answers
43
views
android studio SQL lite database error (android.database.sqlite.SQLiteException)
I copy/paste the already created .db file to my android studio project, but it is crashing my app. That database file is working fine on another android studio project but it is giving exceptions and ...
2
votes
1
answer
60
views
(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, ...
1
vote
0
answers
45
views
How do I insert initial data in a SQLite Database table?
I'm currently trying to create an Flashcard application, in which the user can either create his own cards/notes or use pre-defined cards. The idea is to have around 500 to 1000 cards to be inserted ...
1
vote
0
answers
30
views
migrate Android sqlite database to another app
I have an app with a sqlite database and user data. I have made a new app but it uses the same structure and I would like to migrate the data from the first app.
Both apps need to be in the app store, ...
0
votes
0
answers
22
views
Why do I see this error and check all dependencies version but not solve this issue?
Please resolve this issue check all dependencies version but still not solve this issue anybody help me
dependencies
<pre> { implementation 'androidx.room:room-runtime:2.5.0-alpha01' ...
0
votes
1
answer
274
views
SQLiteException: no such table: database-notes (code 1 SQLITE_ERROR)
I'm trying to migrate a new database version. The only thing changed is an added column. I always get the following error:
android.database.sqlite.SQLiteException: no such table: database-notes (code ...
0
votes
0
answers
79
views
Pre-populating Room using Koin and DB Browser
I need to pre-populate a table in Room using a .csv file.
I saw in https://developer.android.com/training/data-storage/room/prepopulate that I needed a .db file instead so I used DB Browser to import ...
1
vote
1
answer
486
views
How to migrate Room db from 1 to 2?
I'm trying to migrate my Room db to the next version and I keep getting the same error:
java.lang.IllegalStateException: A migration from 1 to 2 was required but not found. Please provide the ...
0
votes
0
answers
97
views
Multi user management with objectbox database
I have an application where a user logs in to their account and stores data according to their account. The user then logs out of their account and logs in with another account and stores other data ...
0
votes
0
answers
16
views
Store/Update large file efficiently
I am working on a grocery app which needs to keep updating the most recent available quantities. To do so, I need to keep overwriting and accessing a large object of quantities which is sent via api ...
-1
votes
1
answer
40
views
Prevent repetitive value from being inserted into database android
Here is my code:
final String[] names_list = { "apple", "banana", "orange" };
final int[] preview_list = { "R.drawable.apple", "R.drawable.banana&...
0
votes
0
answers
21
views
Android: Importing Data. Work with SQLite database
For my application i need dynamic data. To save the data i want to use a SQLite database, which is stored on the device itself.
The data comes from a complete different program which will later run on ...
0
votes
2
answers
209
views
Android Room Entity Enum Field Causes Build Failed
I noticed that since Room 2.3.0-alpha04 it supports Enum field for the Entity (from this post), so I try but failed...
My Gender Enum:
enum class Gender(val value: String) {
MALE("Male"),...
4
votes
1
answer
382
views
Is it normal for Android Room to be storing the prepackaged database in cache?
I'm currently creating an Android application that uses a prepackaged database. The database is initially around 40MB in size and is stored in the assets/databases folder.
The Problem
When I look up ...
1
vote
1
answer
102
views
Android Sqlite not updating prepopulated database
I am using prepopulated sqlite database in my android application. Now the problem is when i update data in my database and i increment the databse version onUpgrade() method is called but my database ...
1
vote
1
answer
309
views
Android Room Embedded Field Not Compiling
I am trying to create an embedded field. This is a simple example but I can't get this simple example to work. Eventually I need to have 3 levels of embedded items but trying to get this test case ...
1
vote
2
answers
107
views
Is there a way to use SQLiteDatabase with Room?
I need to be able to perform a some operations that would be easily done with SQLiteDatabase but I'm using Room. Is there a way for me to get an instance of a SQLiteDatabase object for that Room ...
0
votes
0
answers
23
views
I am making an app and In email field when I enter string value (for example "kin" )it gives me error like this:E/SQLiteLog: (1) no such column: kin
SQL CLASS CODE
public class Databasehelper extends SQLiteOpenHelper {
public static final String DATABASE_NAME= "Employee.db";
public static final String TABLE_NAME= "Employee ";
...
0
votes
2
answers
46
views
what exactly is the syntax error here ? using raw query I want to check email and password exist or not in database
I am checking both the password and email enter by the user is exist in the database or not
String queryEmail="SELECT * FROM " + TABLE_NAME + " WHERE " + col_2 + " = " +...
0
votes
2
answers
71
views
How to insert/update SQLite Database in Android?
I am using the SQLite database to save some information locally. I want to update the row with the same userID each time while saving new data for that particular userID. But it should insert the data ...
1
vote
1
answer
682
views
Trying to prepopulate Room Database from a json using Hilt
I have an app where I am prepopulating my Room Databse with a json file. Here is my database setup for that:
@Database(version = 2, entities = [(ClimbingRoute::class)], exportSchema = false)
abstract ...
0
votes
1
answer
268
views
How to export a database from android app? Empty database result using ADB run-as
I need to populate a file .db programmatically so then I can put this in my asset folder of another project.
So I'm trying to put a lot of data with Room in an empty database and then get the filled ....
9
votes
0
answers
325
views
IllegalStateException: The file system on the device is in a bad state. WorkManager cannot access the app's internal data store
My app is not going to open. When i try to open app it immediately close with below crash.
It is happening in only one device Redmi note 10s.(Android 11)
It seems issue with Workmanager, but didn't ...
1
vote
2
answers
660
views
Query one to many relationship Android Room
I have a one to many relationship. One Parent can hold many Child entities.
The children have the property date, which is of type Instant.
I have made a class which combines these two entities:
data ...
-1
votes
1
answer
142
views
How to store images and some text in android app [closed]
I'm about to make an android app something like "fun places to visit in my city" where u can see photos and description of the place.
I thought something like store all images in drawable ...
1
vote
0
answers
1k
views
Clear all tables in Room
I am using Room and I need to clean the database in specific condition (user-switch).
I am aware that I can delete every table with a DELETE query. However I would rather have an atomic call for ...
0
votes
1
answer
39
views
How to avoid db.update fails if you choose a name that already exists in the table?
The app has:
ListView listing player names from a DB table (only one column, so it is primary key)
EditText to write the new name
Button to update the name of player in the list
*there are more ...
1
vote
1
answer
283
views
how to add prefix in roomDatabase?
I have a problem in my roomDatabase.
I searched on google and found some solutions but I can't solve my problem.
Can anyone help me?
Note : I want to use Object Oriented in my project.
Error :
...
0
votes
1
answer
119
views
Android Studio: Best Method to Save and Retrieve User Input Data
I am new to Android development and need some help. I want to create an app that will log user input information for different tests.
In the first activity, the user will create a hole by inputting ...
-1
votes
2
answers
582
views
How to avoid duplicate rows in SQLite database in Android? [closed]
I am stuck at how do I avoid duplicate rows in Sqlite Database.I tried every possible answer on StackOverflow but none of them worked for me.I tried using unique constraint, db.insertWithOnConflict() ...
0
votes
2
answers
1k
views
How to get all the records between two dates from sqlite database in flutter?
I am trying to develop an app in which users can save their transactions and related information like transaction date, amount, category, etc. All these fields are stored in an SQLite database using ...
0
votes
1
answer
592
views
State Management to hold the data in flutter for sqlite database using sqflite plugin?
I am making an app in flutter using sqflite for the SQLite database, in that app, users can save their financial transaction information like name, amount. date,etc. I am trying to display all the ...
0
votes
1
answer
633
views
How to pass index of sqlite database to another page in flutter app using sqflite?
I am making an app in which users can save the transaction data which they can do by filling out the following form
The transactions then will be saved in the database and can be shown to users on ...
0
votes
0
answers
115
views
How to fetch saved data from SQLite database in a screen for a specific transaction?
I am making an app in which users can save the transaction data which they can do by filling out the following form
The transactions then will be saved in the database and can be shown to users on ...
0
votes
1
answer
698
views
How to save date in SQLite flutter database?
I am making an app in which users can fill a form and can save their financial transaction details for every transaction they make, for this, I want to add a date as well and also I want to fetch data ...
1
vote
1
answer
673
views
Fetching data from sql databse in flutter datewise?
I am making an app in flutter and I am implementing SQL database using the sqflite plugin. In this app, users can create transactions by filling out the form below
Then the user can verify their ...
0
votes
1
answer
264
views
How to delete data from room database inside a broadcast Receiver
In my app, I have a broadcast receiver that send notifications. I want to delete a specific object from the database after the notification is sent. In my activities, I used a viewModel instance to ...
2
votes
0
answers
161
views
Room: Database Folder and Files no longer generated in WearOS App
I developed a project on Wear OS, And it worked until two days ago. The room database showed the files, And the folder, And after verifying the program, And whether it ran correctly, I decided to ...
1
vote
1
answer
263
views
Different typeconverters for different custom object entity in room database
Here i need to store multiple custom entities in same table in room database. This things are working in single typeconverter but when it comes in the case of multiple typeconverters then it is ...
1
vote
1
answer
123
views
How can I ORDER BY a query in Rooms database using date and time which is stored in String format?
I have date and time stored in "yyyy-mm-dd HH:mm" format in my Rooms Database as a String. I want to get the data in descending order of date and time from my Rooms database, however since ...
1
vote
0
answers
141
views
How to get table(entity) size in room?
It's easy to get the database size but it also includes tables which I don't require when I'm doing it for my analytical study. What I want to know is if there is any easy way to get the table size ...
1
vote
0
answers
29
views
How to retrieve a list of rows for a given username and userID from Rooms database?
I have a Rooms database which stores flight information, and I want to retrieve a list of flights which are associated with a given username and userID. I am attaching herewith the code for my ...
2
votes
1
answer
126
views
How can I make the LiveData getValue() function return the list of items from my rooms database in Android?
I have a getAllFlights() method in my ViewModel class which is supposed to return all the flights in my rooms database, however, when I call the method in my activity, it returns null even though I ...