Android Open Source - myToDo D B Open Helper






From Project

Back to project page myToDo.

License

The source code is released under:

Apache License

If you think the Android project myToDo listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.gutspot.apps.android.mytodo.utils;
/*from   www.  ja va2s .c  o  m*/
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DBOpenHelper extends SQLiteOpenHelper {

    private static final int DATABASE_VERSION = 1;
    private static final String DATABASE_NAME = "main";

    private static final String CREATE_TABLE_TODO_SQL = "CREATE TABLE `todo` ("
            + "`_id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"
            + "`created` INTEGER NOT NULL,"
            + "`finished` INTEGET DEFAULT -1,"
            + "`version` INTEGER NO NULL);";

    private static final String CREATE_TABLE_MEMO_SQL = "CREATE TABLE `memo` ("
            + "`_id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"
            + "`todo_id` INTEGER NOT NULL,"
            + "`content` TEXT NOT NULL,"
            + "`text_color` INTEGER NOT NULL,"
            + "`background_color` INTEGER NOT NULL,"
            + "`created` INTEGER NOT NULL,"
            + "`version` INTEGER NOT NULL);";

    private static final String CREATE_TABLE_NOTICE_SQL = "CREATE TABLE `notice` ("
            + "`_id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"
            + "`todo_id` INTEGER NOT NULL,"
            + "`time` INTEGER NOT NULL,"
            + "`version` INTEGER NOT NULL);";

    public DBOpenHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREATE_TABLE_TODO_SQL);
        db.execSQL(CREATE_TABLE_MEMO_SQL);
        db.execSQL(CREATE_TABLE_NOTICE_SQL);

    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        // TODO Auto-generated method stub

    }

}




Java Source Code List

com.gutspot.apps.android.mytodo.MainActivity.java
com.gutspot.apps.android.mytodo.MemoActivity.java
com.gutspot.apps.android.mytodo.ToDoActivity.java
com.gutspot.apps.android.mytodo.adapter.MemoAdapter.java
com.gutspot.apps.android.mytodo.adapter.ToDoAdapter.java
com.gutspot.apps.android.mytodo.dao.AbstractDAO.java
com.gutspot.apps.android.mytodo.dao.MemoDAO.java
com.gutspot.apps.android.mytodo.dao.NoticeDAO.java
com.gutspot.apps.android.mytodo.dao.ToDoDAO.java
com.gutspot.apps.android.mytodo.dialog.DateTimeDialog.java
com.gutspot.apps.android.mytodo.dialog.MemoOptionsDialog.java
com.gutspot.apps.android.mytodo.dialog.ToDoOptionsDialog.java
com.gutspot.apps.android.mytodo.model.AbstractEntity.java
com.gutspot.apps.android.mytodo.model.Memo.java
com.gutspot.apps.android.mytodo.model.Notice.java
com.gutspot.apps.android.mytodo.model.ToDo.java
com.gutspot.apps.android.mytodo.utils.AlertUtil.java
com.gutspot.apps.android.mytodo.utils.DBOpenHelper.java
com.gutspot.apps.android.mytodo.utils.DateTimeUtil.java