Im making an app using a sqlite database I dont have any problems on app launch when i create the database handler object But every time im using a functions like delete, get rows, drop tables, get number of rows the app crash without any error This is part of the code of the database handler
public class DBHandler extends SQLiteOpenHelper {
//Database version
private static final int DATABASE_VERSION = 1;
//Database name
private static final String DATABASE_NAME = "simple_note_db";
//Tables name
private static final String TABLE_NOTE = "notes";
private static final String TABLE_TAG = "tags";
private static final String TABLE_NOTE_TAG = "note_tags";
/* Columns */
//Note columns
private static final String COLUMN_NOTE_ID = "_id";
private static final String COLUMN_NOTE_CONTENT = "content";
private static final String COLUMN_NOTE_CREATED_AT = "created_at";
//Tags columns
private static final String COLUMN_TAG_ID = "_id";
private static final String COLUMN_TAG_NAME = "tag_name";
//Tags columns
private static final String COLUMN_NOTETAG_ID = "_id";
private static final String COLUMN_NOTETAG_NOTEID = "note_id";
private static final String COLUMN_NOTETAG_TAGID = "tag_id";
/*Create table strings*/
private static final String CREATE_TABLE_NOTE = "CREATE TABLE " + TABLE_NOTE + "("
+ COLUMN_NOTE_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
+ COLUMN_NOTE_CONTENT + " TEXT, "
+ COLUMN_NOTE_CREATED_AT + " DATETIME " + ")";
private static final String CREATE_TABLE_TAGS = "CREATE TABLE " + TABLE_TAG + "("
+ COLUMN_TAG_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
+ COLUMN_TAG_NAME + " TEXT " + ")";
private static final String CREATE_TABLE_NOTE_TAG = "CREATE TABLE " + TABLE_NOTE_TAG + "("
+ COLUMN_NOTETAG_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
+ COLUMN_NOTETAG_NOTEID + " INTEGER, "
+ COLUMN_NOTETAG_TAGID + " INTEGER " + ")";
public DBHandler(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_TABLE_NOTE);
db.execSQL(CREATE_TABLE_TAGS);
db.execSQL(CREATE_TABLE_NOTE_TAG);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXITS " + CREATE_TABLE_NOTE);
db.execSQL("DROP TABLE IF EXITS " + CREATE_TABLE_TAGS);
db.execSQL("DROP TABLE IF EXITS " + CREATE_TABLE_NOTE_TAG);
}
EDIT:
07-15 15:18:17.872 164-244/? E/ThrottleService﹕ problem during onPollAlarm: java.lang.IllegalStateException: problem parsing stats: java.io.FileNotFoundException: /proc/net/xt_qtaguid/iface_stat_all: open failed: ENOENT (No such file or directory) 07-15 15:21:09.672 249-252/? D/dalvikvm﹕ GC_CONCURRENT freed 384K, 4% free 19231K/19911K, paused 38ms+7ms, total 83ms 07-15 15:28:17.892 164-244/? E/ThrottleService﹕ problem during onPollAlarm: java.lang.IllegalStateException: problem parsing stats: java.io.FileNotFoundException: /proc/net/xt_qtaguid/iface_stat_all: open failed: ENOENT (No such file or directory) 07-15 15:28:43.232 249-252/? D/dalvikvm﹕ GC_CONCURRENT freed 384K, 4% free 19230K/19911K, paused 30ms+6ms, total 74ms 07-15 15:36:13.851 249-252/? D/dalvikvm﹕ GC_CONCURRENT freed 384K, 4% free 19231K/19911K, paused 38ms+6ms, total 83ms 07-15 15:38:17.901 164-244/? E/ThrottleService﹕ problem during onPollAlarm: java.lang.IllegalStateException: problem parsing stats: java.io.FileNotFoundException: /proc/net/xt_qtaguid/iface_stat_all: open failed: ENOENT (No such file or directory) 07-15 15:43:47.472 249-252/? D/dalvikvm﹕ GC_CONCURRENT freed 384K, 4% free 19231K/19911K, paused 41ms+7ms, total 88ms this is the only error i have, but its displayed also when i dont call funcs from the db handler
this is the only error i have, but its displayed also when i dont call funcs from the db handler
Aucun commentaire:
Enregistrer un commentaire