Database:
db.execSQL("CREATE TABLE " + TABLE_NAME_NOTE + " ("
+ BaseColumns._ID + " INTEGER PRIMARY KEY,"
+ NoteColumns.TITLE + " NVARCHAR(200),"
+ NoteColumns.NOTE + " TEXT,"
+ NoteColumns.CREATED_DATE + " INTEGER,"
+ NoteColumns.MODIFIED_DATE + " INTEGER,"
+ NoteColumns.TYPE + " INTEGER,"
+ NoteColumns.NEED_NOTICE + " INTEGER,"
+ NoteColumns.NOTICE_WAY + " INTEGER,"
+ NoteColumns.NOTICE_TIME + " INTEGER"
+ ");");
here’s my query:
Cursor cursor = mContext.managedQuery(mContext.getIntent().getData(),
NoteEntry.PROJECTION_NOTE,
null, null, NoteColumns.DEFAULT_SORT_ORDER);
the code works ok when NoteEntry.PROJECTION_NOTE is
public static final String[] PROJECTION_NOTE = new String[] {
BaseColumns._ID, // 0
NoteColumns.TITLE, // 1
NoteColumns.NOTE };
but i get the “Invalid column type” exception when i set this
public static final String[] PROJECTION_NOTE = new String[] {
BaseColumns._ID, // 0
NoteColumns.TITLE, // 1
NoteColumns.NOTE,
NoteColumns.CREATED_DATE,
NoteColumns.MODIFIED_DATE,
NoteColumns.TYPE,
NoteColumns.NEED_NOTICE,
NoteColumns.NOTICE_WAY,
NoteColumns.NOTICE_TIME
};
So confused.
And another question, should i use INTEGER type to store the Date data as the Created_Date field, the code sample in sdk does. I’m new to sqlite and android.
Pls help me.Thanks a lot.
“Type” is the column name
and found this way to solve the problem, still don’t understand: