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
votes
2 answers

SQLiteOpenHelper issue

Hello I try to develop one application based on the SQLiteDatabase. I develop simple code which create database but it's not working in AVD means its crash the application. Please guys help me out. I post my code and error for that. It is very…
Bhaumik
  • 11
  • 1
  • 7
-1
votes
2 answers

How do I use SQLiteOpenHelper in a secondary class?

As a new Android programmer, I followed various online examples to create my own class that extends SQLiteOpenHelper... public class MySQLiteHelper extends SQLiteOpenHelper { private static final int DATABASE_VERSION=1; private static final String…
Peter
  • 427
  • 4
  • 14
-1
votes
1 answer

Run OR statement in SQLiteOpenHelper for the same column

I have a function in my DatabaseHelper class (extends SQLiteOpenHelper) that returns row based on a certain column's value. Code snippet as follows: Cursor cursor = db.query(TABLE_LOCATIONS, new String[]{}, COLUMN_PROD_ID+"=?", productId, null,…
camelCaseCoder
  • 1,447
  • 19
  • 32
-1
votes
1 answer

How to update list item in sql?

This is my list activity: public class List extends ActionBarActivity{ private CustomCursorAdapter customAdapter; private PersonDatabaseHelper databaseHelper; private static final int ENTER_DATA_REQUEST_CODE = 1; private ListView…
TheDude
  • 135
  • 4
  • 17
-1
votes
1 answer

Getting Null Pointer Exception in Sqlitedatabase.query method

I know this is a pre-asked question. But still I am not able to find solutions. I am opening a database with a SQLiteOpenHelper and applying insert and query method in SQLiteDatabase object. But I am getting NullPointerException in query method…
Mayank Jindal
  • 355
  • 5
  • 15
-1
votes
2 answers

Android Database in AsyncTask in Fragment

I have a DbHelper Class which extends SQLiteOpenHelper. I do Some Download and update the Database inside an Asynctask. Inside an activity i got no problem and code works fine, but when i use the ASynctask class inside a fragment problems…
-1
votes
2 answers

Android: Rerun Database onCreate() if it fails

Because of some poor decisions, I am stuck with an onCreate() in my SQLiteOpenHelper class that can run for up to 5 minutes. The user could turn off his phone, or force close the app during this process, meaning my onCreate() will be canceled…
ZakTaccardi
  • 12,212
  • 15
  • 59
  • 107
-1
votes
1 answer

SQlite-Foreign key

hello i'm a beginner in sqlite in android i made a 2 tables database and i'm trying to make a foreing key in the second table which is the id of the first table here is the code and i would appreciate if you tell me if there is other errors in the…
-1
votes
1 answer

Unable to start component activity Component Info Null Pointer Exception

I'm not sure how to find the line number in the Logcat output. Also, with this latest Android Studio version, the regular logcat doesn't work, so I have to start the Android Device Monitor to get a look at it. And I can only snag a png, so sincere…
-1
votes
3 answers

No such table even though db.execSQL(sql) executes without an error

I have a weird issue to work through. The system properly calls the SQLiteOpenHelper onCreate() method and it also seems that db.execSQL(sql) is successful, but the table is never created. I'm accessing the VM using "adb devices" >> cd into the…
fergatron
  • 13
  • 6
-1
votes
2 answers

Database Handler , Add Item Issue

I am having trouble with insert query. when i try to insert into the database, it says in the log cat that active: column does not exists. can you please point out where am i making mistake. I am actually getting this exception: SQLiteException:…
Hassaan Rabbani
  • 2,469
  • 5
  • 30
  • 55
-1
votes
1 answer

error in sqlite db using two different class in my android app

package com.example.myfirstapp; public class DB_Moshtari { /******************** if debug is set true then it will show all Logcat message ************/ public static final boolean DEBUG = true; /******************** Logcat TAG…
farbod_chitsaz
  • 37
  • 1
  • 11
-1
votes
1 answer

Issue in accessing database in Android, Table isn't getting created

It seems like the database gets created, but I get error when I try to access the database that was created. Whenever the doQuery() is invoked, the app crashes. Could you please help me figure out what I am doing wrong? private class LoadCursorTask…
-1
votes
1 answer

SQLite Database Android .......... just basic thing < Dont know y dosent work :/ >

I was just learning about sqlite databases and tried a small application to just add entries into a sqlite data base ....... don't know why it doesn't work ..... I'm really frustrated and almost to lose my interest on this android stuff ....... any…
sarath
  • 45
  • 8
-1
votes
1 answer

Best practice for using a single SQLiteOpenHelper for use by many ContentProviders

In my app (a SyncAdapter) I include many ContentProviders for use by other apps and was wondering whether it is appropriate to attempt to share a single SQLiteOpenHelper instance between them all to use? If so, how? If that's not appropriate, is…
fr1550n
  • 1,055
  • 12
  • 23