Hello i am having a problem creating a table in onCreate in my class that extends SQLiteOpenHelper, here's the code:
public class EntriesDatabaseHelper extends SQLiteOpenHelper {
    private static final int DATABASE_VERSION = 1;
    private static final String DATABASE_NAME = "accounts.db";
    private static final String TABLE_NAME = "diary";
    private static final String COLUMN_ID = "id";
    private static final String COLUMN_TITLE = "title";
    private static final String COLUMN_DETAILS = "details";
    private static final String COLUMN_SAVE_DATE = "save_date";
    private static final String COLUMN_USER_ID = "user_id";
    SQLiteDatabase db;
    private static final String TABLE_CREATE = "create table " + TABLE_NAME
        + " (" + COLUMN_ID + " integer primary key not null, "
        + COLUMN_TITLE + " text not null, "
        + COLUMN_DETAILS + " text not null, "
        + COLUMN_SAVE_DATE + " text not null, "
        + COLUMN_USER_ID + " integer not null);";
    public EntriesDatabaseHelper(Context context){
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }
    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(TABLE_CREATE);
        this.db = db;
    }
    @Override
    public void onUpgrade(SQLiteDatabase db, int i, int i1) {
        String query = "DROP TABLE IF EXISTS " + TABLE_NAME;
        db.execSQL(query);
        this.onCreate(db);
    }
    public void insertEntry(DiaryEntries entries){
        db = this.getWritableDatabase();
        ContentValues values = new ContentValues();
        String query = "SELECT * FROM " + TABLE_NAME;
        Cursor cursor = db.rawQuery(query, null);
        int count = cursor.getCount();
        values.put(COLUMN_ID, count);
        values.put(COLUMN_TITLE, entries.getTitle());
        values.put(COLUMN_DETAILS, entries.getDetails());
        values.put(COLUMN_SAVE_DATE, entries.getDate());
        values.put(COLUMN_USER_ID, entries.getUser_id());
        db.insert(TABLE_NAME, null, values);
        db.close();
    }
}
Error: android.database.sqlite.SQLiteException: no such table: diary (code 1): , while compiling: SELECT * FROM diary
full logcat:
FATAL EXCEPTION: main
               android.database.sqlite.SQLiteException: no such table: diary (code 1): , while compiling: SELECT * FROM diary
               at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
               at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)
               at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500)
               at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
               at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
               at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
               at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
               at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1314)
               at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1253)
               at elec4.app.android.diaryapp.EntriesDatabaseHelper.insertEntry(EntriesDatabaseHelper.java:55)
               at elec4.app.android.diaryapp.WriteDiary$1.onClick(WriteDiary.java:81)
               at android.view.View.performClick(View.java:4240)
               at android.view.View$PerformClick.run(View.java:17721)
               at android.os.Handler.handleCallback(Handler.java:730)
               at android.os.Handler.dispatchMessage(Handler.java:92)
               at android.os.Looper.loop(Looper.java:137)
               at android.app.ActivityThread.main(ActivityThread.java:5103)
               at java.lang.reflect.Method.invokeNative(Native Method)
               at java.lang.reflect.Method.invoke(Method.java:525)
               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
               at dalvik.system.NativeStart.main(Native Method)
here's the code where use the class:
EntriesDatabaseHelper helper = new EntriesDatabaseHelper(this);
DiaryEntries entries = new DiaryEntries();
             entries.setTitle(data_title);
             entries.setDetails(data_details);
             entries.setDate(date);
             entries.setUser_id(Integer.parseInt(user_id));
             helper.insertEntry(entries);
             //inserted into the database
             finish();
it should already created the table but how come it isnt. help thanks
 
    