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
0 answers

android.database.sqlite.SQLiteException: no such table: (code 1)

Hi After three days of browsing, debugging i couldn't find the reason of the error I created database using SQLite DB Browser extension - firefox I added in my assets (but its showing a question mark in the icon to the left of the DB name in ndroid…
JalilIrfan
  • 158
  • 1
  • 14
1
vote
1 answer

SQlite: IllegalStateException:Could not execute method of the activity, while inserting a row

Im following a tutorial I want to insert a row into table while doing this Its run time fatal exception while inserting a row into database Its Helper database class: DatabasaeAdaptor.java package com.example.sarahn.inserttable; import…
1
vote
3 answers

Writing to database when app is closed

I'm using gcm for chat, and I have an onMessageReceived() method that receives the messages, saves them in the database, and sends a notification to the user. When the app is running (or paused - running in the background), this is how I store the…
Alaa M.
  • 4,961
  • 10
  • 54
  • 95
1
vote
0 answers

onUpgrade() and onCreate() method do not invoke when creating a new version of database in SQLiteOpenHelper

I am trying to create a new version of database in my android app. But although I change the version of database from previous version (2) to a new version (3) it doesn't invoke onUpgrade() and onCreate() . It just invoke three times the…
Md. Nasir Uddin Bhuiyan
  • 1,598
  • 1
  • 14
  • 24
1
vote
3 answers

No such table found even though app successfully opens database from assets folder

I'm new to android development. I'm trying to use a pre-populated database whoch is stored in my assets folder. Log shows that the database gets opened but 'NO SUCH TABLE ERROR' is shown.I can't find any solution to this error. Please…
1
vote
1 answer

Can i pass DBHelper class object to anther class which is a library class

I have a DBHelper class which is extended from SQLiteOpenHelper,i created object for DBHelper in my one of the class file.and i want to send the object of that DBHelper class to a Library class with a Specific method. Is there any possibility. Can i…
Hari Enaganti
  • 359
  • 1
  • 4
  • 12
1
vote
2 answers

SQLiteOpenHelper - Where do I store initial data?

I have some initial data to insert in my database. I've added it to my custom SQLiteOpenHelper class. package com.company.database; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import…
Thom Thom Thom
  • 1,279
  • 1
  • 11
  • 21
1
vote
2 answers

Do you have to alter the database schema in the onUpgrade method of the SQLiteOpenHelper?

I'm trying to write an android app that contains a database that would dynamically change its schema based on user input. For example, suppose that you initially have a table in which the only column is a column for different breeds of puppies. This…
Nick
  • 13
  • 2
1
vote
1 answer

Update Database Entry Displayed in Fragment Listview by Dialog

I have a Fragment that displays a Listview which is populated with entries from a Database using SQLiteOpenHelper. I currently have ContextMenu that allows entries to be deleted or edited. The DELETE option functions and removes the entry from my…
1
vote
0 answers

SQLite file copied from Assets folder by Android SQLiteOpenHelper corrupted?

I used sqlite3 on my Mac to create a small database file (surnamed ".db") containing one table, plus the android_metadata table containing "en_US". I pasted the file into the assets folder of my Android Studio project. At runtime, the onCreate…
Mark Meretzky
  • 89
  • 1
  • 6
1
vote
2 answers

android passing variables from inside database class

I am trying to pass some values that i get from inside database(that extends sqliteOpenHelper) to another class. However i am using a cursor to get the data from that database which giving null values to other activities. Here is my Database: it has…
Jedi Fighter
  • 377
  • 1
  • 4
  • 20
1
vote
1 answer

onCreate() method of SQLiteHelper is never called

I'm creating a database in android using SQLite. I wrote my code to create a table called products in onCreate() method. Then when I call add() method to add some values into the table, I'm getting an error that there is no such table called…
Nikhil
  • 6,493
  • 10
  • 31
  • 68
1
vote
2 answers

How to insert data in SQLite database on android

I am trying to insert data in a database table signals, which has 5 columns(id,SSID,BSSID, RSSID, Poloha). I am getting an Error in Logcat: E/SQLiteLog﹕ (1) table signals has no column named RSSID E/SQLiteDatabase﹕ Error inserting…
1
vote
0 answers

SQLite trouble with multiple concurrently open connections

I'm having SQLite trouble in a multithreaded application. I have an Activity which uses a subclass of AsyncTaskLoader to perform some data import from a file (specified by an Uri as it comes from Android Storage Access Framework), and when the…
wujek
  • 10,112
  • 12
  • 52
  • 88
1
vote
1 answer

Can't use SQLite Default while onCreate

i am having a issue with the Android SQLite Database. I want to set some default values, when i create the database with onCreate(). The database gets created but the table is empty. //Datenbank anlegen private static final String…
Nick
  • 135
  • 1
  • 4
  • 13