Questions tagged [android-database]

General programmatic usage of databases on Android

Databases and tools related with persistence supported by the Android operating system.

584 questions
2
votes
2 answers

Formatting multine Text with bullet points from Database

I have a TextView where I display the Text from the database which can inclued bullet points: My TextView is inside a ScrollView with a LinearLayout and has nothing special:
Deno Agüero
  • 519
  • 2
  • 9
  • 27
2
votes
3 answers

Check if row is inserted into Room database

I am inserting rows into Room database and I want to check if the row is inserted successfully. This is my Dao @Insert() suspend fun insertOfflineData(offlineData: OfflineData): Long @Entity data class OfflineData( @PrimaryKey(autoGenerate =…
BRDroid
  • 3,920
  • 8
  • 65
  • 143
2
votes
2 answers

How to sort LiveData from Room Database? Doing a button to switch recyclerview's item's order

Hello, I have two problems which I can't solve at all, but which I think are ultimately related. I am triyng to do the following: I have an activity (Nota) which serves as an add/edit note java class. I want to display these notes in the…
2
votes
2 answers

How can I fix my Android SQLite Database?

I'm a beginner programmer making an android app, so I really need your help. I know that my question is super long, but I will be grateful if you guys answer my quest I am making an app that selects 1 word randomly from many words in a table. Thus,…
2
votes
1 answer

FOREIGN KEY constraint failed (code 787) [NO ANDROID ROOM]

I have an Android Project on Android Studio with a DataBase which has 3 tables, and one had two FK. I think I saw every code with a solution and any work for me. This is the error: E/SQLiteDatabase: Error inserting…
2
votes
3 answers

Room DB Upgrade need to write full insert query

Hi I am developing an android app and I am using room DB and I have created one table and now I want to add another table I need to write a migration for that and in-migration I need to write full SQL queries for the new table assume I have more…
2
votes
2 answers

onDelete = NO_ACTION causes error: "SQLiteConstraintException: FOREIGN KEY constraint failed" (code 787)

I am using Room on top of SQLite for Android, and I have the following two Pojo entities: @Entity public class Event { @PrimaryKey @NonNull private String eventId; private String eventName; } @Entity(primaryKeys =…
Mena
  • 3,019
  • 1
  • 25
  • 54
2
votes
1 answer

SupportSqliteQueryBuilder giving a wrong query results

I am trying to create the following Query using SupportSQLiteQueryBuilder : SELECT * FROM tablename WHERE favorite=1 ORDER BY col1 I used the following code to build this query: public static SupportSQLiteQuery getSortedQuery(String…
ansh sachdeva
  • 1,220
  • 1
  • 15
  • 32
2
votes
0 answers

What version of SQLite added support for the lead() and lag() functions?

I am trying to use the following query as part of a larger query in my Android SQLite datbase, but it seems to me that the errors I'm receiving point to Android SQLite not supporting the lead() function yet. I've tried looking through the release…
Ben Bloodworth
  • 900
  • 11
  • 26
2
votes
1 answer

Do I need an AsyncTask to Query a row in my Android Room Database?

I am doing a map activity, on marker click, I would display the information on a textview. The information is saved in android room database because I need the data to persist. I want to query only a row with the name of the column, marker tag I…
Peter
  • 437
  • 1
  • 4
  • 20
2
votes
0 answers

Android Room Entity inheritance

I've already seen a threads similar to this, but none of them answers my question. So let's say we have two classes: Lesson Break Both of them are implementing SchoolEntity interface, which has the following methods: Date getStartDate() Date…
Gieted
  • 835
  • 6
  • 21
2
votes
1 answer

How to make reference to another tables? (SQLite)

I am making a list of Images with Tags so I decided to make a SQLite Database with ImagesPath and Tags. I know that I have to combine these two tables in the state many do many but i really don't know how. I have three tables: 1)ImagesPath (INT id,…
MrFisherman
  • 720
  • 1
  • 7
  • 27
2
votes
1 answer

Gradle Multi module annotationProcessor compilation issue between Room Database And Glide Plugins

below is my build.gradle file dependencies dependencies { def room_version = "1.1.1" implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:28.0.0' implementation…
Feroz Siddiqui
  • 3,840
  • 6
  • 34
  • 69
2
votes
3 answers

Database importing problem in Android Pie?

I’m using Preload Database with multiple Tables with data already present in tables in all tables. My Error logcat shows “no such table: cake (code 1 SQLITE_ERROR): , while compiling: select * from cake at” but actually table and its data are…
2
votes
3 answers

Realm Database Multiple Tables

I got confused about the concept of tables and realm although I read the Realm documentation. As I know a realm is a like Table, but it can store multiple Models. The problem is, I want to have multiple tables (some of them just contain objects of 1…
MH. Abdi
  • 298
  • 5
  • 22