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

Cannot insert values into SQLite database in android

I have three classes. One is an activity which sends the text of EditTexts to another class: String[] comments = new String[]{ number.getText().toString(), vessel_name.getText().toString(), ... } //20 such values comment =…
1
vote
1 answer

Why does SQLiteOpenHelper cause IllegalArgumentException database not open?

First of all, all similar postings here didn't help. In an AsyncTask I check if the app startup is the very first startup at all, that means I check if there is a database at all. I want to do that by query from a table. This is what is being…
Bevor
  • 8,396
  • 15
  • 77
  • 141
1
vote
1 answer

I need to get the data from database and display them in another activity

I'm new to android programming. I have a database class in which I have Name, Company, Location columns. In the Main Activity I have AutoCompleteTextBox and a Button. For example, If I enter SUGAR in the search box and click the search button, it…
goutham07511
  • 11
  • 1
  • 3
1
vote
2 answers

Logcat message: error opening trace file: No such file or directory (2) Can anyone help me?

Java Code: public class SplashActivity extends Activity implements OnClickListener { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.welcome); …
1
vote
2 answers

Eclipse LogCat Error : android.database.sqlite.SQLiteException: no such table:

public class DBHelper extends SQLiteOpenHelper{ //The Android's default system path of your application database. private static String DB_PATH = "/data/data/com.tmm.android.chuck/databases/"; private static String DB_NAME =…
Piyush Chandra
  • 109
  • 3
  • 14
1
vote
3 answers

Cannot make a static reference to the non-static method error

I am getting the following error from my code 'Cannot make a static reference to the non-static method getReadableDatabase() from the type SQLiteOpenHelper' in the Database.java file. If I use Eclipse to solve the error then an error happens in…
Ryaller
  • 77
  • 3
  • 12
1
vote
1 answer

Android: long => SQLiteDatabase => long , precision lost

I'm creating an app which includes data stored in an SQLitedatabase. I use a long as primary key (generated buy the significant bits of an java.util.UUID). I handle the database connection with an extended SQLiteOpenHelper. The query: INSERT INTO…
SverkerSbrg
  • 503
  • 1
  • 9
  • 23
1
vote
1 answer

Database unable to get a connection

I'm developing an Android application that uses sqlite database from differens threads and process, such as Widget and services. Using the singleton pattern to grant a connection, I randomly get this error: the app remains stuck in the…
Spotlight
  • 1,279
  • 1
  • 13
  • 28
1
vote
2 answers

When are SQLiteOpenHelper methods called?

I'm struggling to understand the idea behind SQLiteOpenHelper. It has onCreate()/onUpdate() methods which should be overridden, but I don't understand what calls them or when they are called. Will Android call those methods when the app is run at…
Davita
  • 8,928
  • 14
  • 67
  • 119
1
vote
2 answers

DataBase not Created in SQLite

I Built one same app which takes the data from User. I attempted to save the data into SQLite database. When I run the app, the interface seems to be working good. But when I click on "save" button, App gets closed by giving an error…
Mahe
  • 2,707
  • 13
  • 50
  • 69
1
vote
0 answers

android.database.sqlite.SQLiteCursor@

I got that Error. How could I eliminate the android.database.sqlite.SQLiteCursor@ instead of INTEGER value alone? And how could I get the integer Value from my consumer table which is AccountID and Save it as FOREiGN KEY into my consumptions table?…
1
vote
1 answer

How to query a single item based on its name in a sql database and return cursor?

I have a database with all food items. I want to search the database for a variable food item and get its Cursor. Let us take food item = Oranges as an example. The following line gives the correct result when typed in terminal. SELECT * from food…
Rohit_D
  • 85
  • 1
  • 11
1
vote
2 answers

no such table: ogrenci: , while compiling: INSERT INTO

I am trying to configure a simple SQLiteOpenHelper, and getting an error while executing. The error is: Table ogrenci has no column named field__final While compiling: INSERT INTO ogrenci(field__final, field__numarasi, field_ad, field__vize,…
Erkan
  • 33
  • 2
  • 9
1
vote
1 answer

Android - Why am I getting NullPointerException in SQLiteOpenHelper onCreate?

I have used LogCat to determine the problem line. The SQL String I am trying to execute in onCreate is.. CREATE TABLE Routines(_id integer primary key autoincrement, json TEXT); When it tries to execute this, the problem occurs. This may well be…
mgibson
  • 6,103
  • 4
  • 34
  • 49
1
vote
1 answer

Inserting Multiples Records into Two Columns in Sqlite Database using ContentValues

Whenever I use the following code to insert multiple records into a table it only inserts the last initialized value. Here's the method for inserting data into a table: public long insertQuote() { ContentValues initialValues = new…
beerBear
  • 969
  • 2
  • 17
  • 41