Questions tagged [sqliteopenhelper]

SQLiteOpenHelper is a class from the Android SDK which can be used for easier handling of a SQLiteDatabase.

Using the SQLiteOpenHelper only requires implementing its two abstract methods(other methods for different events can be implemented if the user chooses) onCreate(used for initializing the database) and onUpgrade(used when the database is being changed). The Android system will call this methods according to the state of the database( not created/created/upgrading) and in return, it will offer the user a valid SQLiteDatabase reference with the methods getWritableDatabase() and/or getReadableDatabase(). More information can be found in the documentation for the SQLiteOpenHelper class.

801 questions
1
vote
2 answers

Android SQLite: No such table error when trying to fetch data from Database

I am trying to use an already created DB from a csv file using DB Browser. I tried uninstalling and re-installing the app. Also upgraded the DB version and still the same error occurs! Checked my DB path and if the file is being created or…
1
vote
1 answer

SQLite Autoincrement not inserting

I have an SQLite Database and when I insert the ID should be automaticly incrementet with AUTOINCREMENT. But it is always null. This is the create table @Override public void onCreate(SQLiteDatabase db) { db.execSQL("CREATE TABLE…
J.Doe
  • 177
  • 1
  • 2
  • 13
1
vote
2 answers

How to store data to external sqlite database and display in RecyclerView

I have created an external sqlite database with book information stored in it. Its store in the asset folder. I have created a book object, but now i am not sure how to store values from database in it. I have used a list function to retrieve the…
1
vote
2 answers

Display Data in android application for specific activity

I have the following application Where the user have to signup with (Email ,pass ,Hight ,Weight).. then he will login with Email and pass -> choose Calculate BMI option -> Here in this activity i want to display the result of BMI calculation for the…
shahad
  • 21
  • 4
1
vote
1 answer

sqlite database /retrofit (json object)

im a newbie here. my problem goes with this; i like to send all my data created from my sqlite database and send it all to my custom api via json object. is this possible? if is it, can you give me reference on how to do it? because i can't find any…
user6440030
1
vote
1 answer

How to differentiate between same Id values in SQLite Android

The problem I am going through is the schema I think. I need to know how to differentiate between the same values regarding their colour. For example, I have an item in different colours & sizes. What schema can help me overwrite if the user has…
1
vote
0 answers

What is the correct way to handle "IllegalStateException: database already closed" , while creating the database in android

There are many one - liner solutions that might correct the error , but can any one give an complete description or an example on what should be right way to open , do some operation( delete/query etc.) on the database ,close cursor and close…
Kaveri
  • 1,060
  • 2
  • 12
  • 21
1
vote
0 answers

Custom table creation

I have made a database using dbhelper previously, and now I want to add a table in that using this code. But I am getting error that no such table found. Please can you help me out with this. Should I need to open database every time and can I make…
1
vote
1 answer

How to populate ListView with db in asset folder?

so I want to make an app that lists foods that I have stored in an already existing SQLite database I created. I have my foodDB.db file in the /assets/databases folder. I know I must use a DatabaseHelper class. I have done my fair share of research,…
user7262674
1
vote
2 answers

SqLiteDatabase writable Vs. ReadOnly

I don't get any sense why they are writing two opposite variables in Logical OR. True || False = True, or False || True = True. Why this check is necessary? if (mDatabase != null) { if (!mDatabase.isOpen()) { // Darn! …
Uddhav P. Gautam
  • 7,362
  • 3
  • 47
  • 64
1
vote
1 answer

Cannot resolve method 'reopenReadWrite()'

I am trying to create a login page and connect go to SQLite database using SQLiteOpenHelper class. But the default code in SQLiteOpenHelper.java shows error at line db.reopenReadWrite(); I checked that SQLiteDatabase.java file has the method…
1
vote
0 answers

onCreate method in SQLiteOpenHelper class is not called even though the table doesn't exist

Here is my code: public class ResultDbHandler extends DatabaseHandler { private final String TABLE_RESULTS = "results"; private final String RESULT_ORDER = "order"; private final String RESULT_PROFILE = "resultProfileId"; private…
1
vote
0 answers

can't create database using sqliteopenhelper class in android

Here is my code of the DataBase class. I don't understand why I'm not able to create the table articles. Error message says "no such table:articles(code1):,while compiling: select * from articles". I'm totally clueless why is this happening. Please…
1
vote
0 answers

SQLite in android doesn't have Math functions

I'm trying to show images based on location in android, it seems sqlite doesn't support Math functions, i have no idea what should i do, i have just 1 day to meet the dead line and no way to use NDK to define functions because i have no idea what…
Basil Battikhi
  • 2,638
  • 1
  • 18
  • 34
1
vote
2 answers

SQLite Database in Android database doesn't created

I'm trying to create a simple database in android, but the database doesn't created and i don't know why. I read many solutions but nothing help. This is the SQLiteOpenHelper extended class public class TodoDB extends SQLiteOpenHelper { public…