Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.database.sqlite.SQLiteDatabase;

public class Main {
    private static final String TABLE_HISTORY = "History";
    private static final String KEY_HISTORY_ID = "id";
    private static final String KEY_HISTORY_TYPE = "type";
    private static final String KEY_HISTORY_LEVEL = "level";
    private static final String KEY_HISTORY_POINT = "point";
    private static final String KEY_HISTORY_DATETIME = "datetime";
    private static final String KEY_HISTORY_DESCRIPTION = "description";

    static public void clearHistory(SQLiteDatabase db) {
        db.execSQL("DROP TABLE IF EXISTS " + TABLE_HISTORY);
        createHistoryTable(db);
    }

    static void createHistoryTable(SQLiteDatabase db) {
        String CREATE_HISTORY_TABLE = "CREATE TABLE " + TABLE_HISTORY + "(" + KEY_HISTORY_ID
                + " INTEGER PRIMARY KEY," + KEY_HISTORY_TYPE + " INTEGER," + KEY_HISTORY_LEVEL + " INTEGER,"
                + KEY_HISTORY_POINT + " INTEGER," + KEY_HISTORY_DATETIME + " INTEGER," + KEY_HISTORY_DESCRIPTION
                + " TEXT)";
        db.execSQL(CREATE_HISTORY_TABLE);
    }
}