Android SQLiteOpenHelper is not working

The onCreate void of my SQLiteOpenHelper is not called even when get a databse with “database = helper.getWritableDatabase();”. I read lots of posts on this page here but I didn’t find any soloution that worked for me.


package eu.michael1011.currencies.sql;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class Helper extends SQLiteOpenHelper {

    public static final String database_name = "currencies.db";

    public static final String col1 = "id";
    public static final String col2 = "value";

    public Helper(Context context) {
        super(context, database_name, null, 1);

    public void onCreate(SQLiteDatabase db) {
        Log.d("database", "started");

        db.execSQL("create table EUR ("+col1+" TEXT, "+col2+" TEXT)");

        Log.d("database", "finished");

    public void onUpgrade(SQLiteDatabase db, int i, int i1) {
        db.execSQL("drop table if exists EUR");



I call it in my main activity like this:

    helper = new Helper(getBaseContext());
    database = helper.getWritableDatabase();

Source: java

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.