Login or sign up Lost password?
Login or sign up
So for this we just need three tables in the database. As this class is helper class, place this under helper package. So create another class named public class Database Helper extends SQLite Open Helper { // Logcat tag private static final String LOG = "Database Helper"; // Database Version private static final int DATABASE_VERSION = 1; // Database Name private static final String DATABASE_NAME = "contacts Manager"; // Table Names private static final String TABLE_TODO = "todos"; private static final String TABLE_TAG = "tags"; private static final String TABLE_TODO_TAG = "todo_tags"; // Common column names private static final String KEY_ID = "id"; private static final String KEY_CREATED_AT = "created_at"; // NOTES Table - column nmaes private static final String KEY_TODO = "todo"; private static final String KEY_STATUS = "status"; // TAGS Table - column names private static final String KEY_TAG_NAME = "tag_name"; // NOTE_TAGS Table - column names private static final String KEY_TODO_ID = "todo_id"; private static final String KEY_TAG_ID = "tag_id"; // Table Create Statements // Todo table create statement private static final String CREATE_TABLE_TODO = "CREATE TABLE " TABLE_TODO "(" KEY_ID " INTEGER PRIMARY KEY," KEY_TODO " TEXT," KEY_STATUS " INTEGER," KEY_CREATED_AT " DATETIME" ")"; // Tag table create statement private static final String CREATE_TABLE_TAG = "CREATE TABLE " TABLE_TAG "(" KEY_ID " INTEGER PRIMARY KEY," KEY_TAG_NAME " TEXT," KEY_CREATED_AT " DATETIME" ")"; // todo_tag table create statement private static final String CREATE_TABLE_TODO_TAG = "CREATE TABLE " TABLE_TODO_TAG "(" KEY_ID " INTEGER PRIMARY KEY," KEY_TODO_ID " INTEGER," KEY_TAG_ID " INTEGER," KEY_CREATED_AT " DATETIME" ")"; public Database Helper(Context context) @Override public void on Create(SQLite Database db) @Override public void on Upgrade(SQLite Database db, int old Version, int new Version) From now on we are going to add one by one method into Database Helper.class The function will create a todo item in todos table.