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
1
vote
1 answer

Database file is empty but database is working

I am facing a strange problem. My app, including the database is working fine. However, when I save the database file and inspect it with sqlite it is empty. What I do: I go to the device file explorer, go data->data->my.app.package->databases->…
Gerke
  • 926
  • 1
  • 10
  • 20
1
vote
3 answers

How to Order Room results by Date as String

I have a room database. I have a column for date and it's saved as string. I used this query for sort my column : @Query("SELECT * FROM session WHERE class_id = :classId ORDER BY session_date ASC") List getAllSessions(int…
1
vote
1 answer

How to fetch vehicle owner information from registered number plate?

I'm working on an Android application where I need to fetch data from a particular website ("https://parivahan.gov.in/rcdlstatus/?pur_cd=102) but it shows captcha before submitting the query. What should I do? There are tons of applications…
jatin mohan
  • 13
  • 1
  • 3
1
vote
4 answers

How to add primary key in room database?

I have a sqlite database and i want to change my database to Room database. One of tables has no any primary key and just have two foreign key. I created the table before room with this query: CREATE TABLE student_performance( class_id int ,…
1
vote
1 answer

Removing data in ObjectBox based on Id

I would like to remove the data on my ObjectBox database in Android based on its Id. Is this correct? Box box = ObjectBox.get().boxFor(Cart.class); Cart order = box.get(id); box.remove(order); Thank you
vidalbenjoe
  • 921
  • 13
  • 37
1
vote
2 answers

android.database.sqlite.SQLiteException: no such column: exist

app is crashing in very specific case if i install the app while the device local is English than no crash happen and everything is working as it should be. if i change the device local to Arabic after the app being installed on English version…
Hossam Hassan
  • 795
  • 2
  • 13
  • 39
1
vote
0 answers

Android one library used by two apps

Is it possible to write an Android library that is used by two different android apps, but has a single instance on a device? In a way, it would be a "singleton library" on device scope. I.e. I would like to break an app into 3 pieces: a client…
daneejela
  • 13,081
  • 7
  • 38
  • 50
1
vote
1 answer

Problem with searching String name in RecyclerView that contains String name and String subtext

Well, I have a RecyclerView, whose Items contains name and subtext. I created a class MyObject in order to fill them. With my Adapter, I am filling the RecyclerView. I want to search for a String name in my RecyclerView and that the application…
1
vote
2 answers

cursor is crashing with CursorIndexOutOfBoundsException

My cursor is crashing my application with the android database error. CursorIndexOutOfBoundsException: Index -1 requested, with a size of 1 I made another much less optimized slider that scans my database and I find the good value. public Cursor…
1
vote
2 answers

How can I save the button's state(e.g. button's visibility) inside a RecyclerView item even after the application is entirely closed?

I am trying to save the button's state in a certain item of RecyclerView whenever a user clicks that button. At the time it was clicked, it's visibility will be gone and another button will be visible. How can I save the button's state so that…
1
vote
1 answer

How to create an android app database that will be modified in real time?

i just started Android Development a few weeks ago for a college project : an Android application that manages the transport of students (with several buses) from their home to school with a geolocation service. So I have already made a schema of my…
Odess4
  • 420
  • 5
  • 17
1
vote
1 answer

Should I create a class that inherits SQLiteOpenHelper for each table in my database?

I need to create an android app database , but I was wondering if I should create one class that inherits SQLiteOpenHelper for each table that exists in my database ? Or should I create One class : for example MyAppDatabase that inherits from…
Odess4
  • 420
  • 5
  • 17
1
vote
2 answers

Data is not updated normally (room database)

I need when refresh page make request to API and insert getting data to my room database. But when I try to insert data I get io.reactivex.exceptions.OnErrorNotImplementedException: UNIQUE constraint failed: data.id (code 1555). So I decided to…
1
vote
2 answers

Using existing database to display data in Android app

Hi I am new to android development. I have already created SQLite Database and saved it in my assets folder in Android Studio. My app has to use the existing database instead of creating a new one. The problem that I am facing is that when I want to…
Amay
  • 104
  • 6
1
vote
2 answers

Room database - edit entities

I have a question. I edited my Room entity from this: @Entity(tableName = "users") public class User { public User(String username, String email, String password){ this.username = username; this.email = email; this.password =…
michasaucer
  • 4,562
  • 9
  • 40
  • 91