mercredi 3 février 2016

Creating an android database - "Implicit super constructor SQLiteOpenHelper() is undefined for default constructor"

I've been trying to create a database through SQLite, however it seems to have a problem with importing it. Here is my database.java

I've had a look round and people have the same code as mine and theirs works.

the line import android.database.sqlite.SQLiteDatabase; is underlined red and the error states:

Implicit super constructor SQLiteOpenHelper() is undefined for default constructor. Must define an explicit constructor

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

public class Database extends SQLiteOpenHelper {
    public static final int db_version = 1;
    public String createQuery = "CREATE TABLE "+tableColumns.Table+"("+tableColumns.Username+" TEXT,"+tableColumns.Password+" TEXT );";            
    //constructor generated automatically
    public Database(Context context) {
        super(context, tableColumns.Database, null, db_version);
        Log.d("Database", "Database Created Successfully");

    }

Aucun commentaire:

Enregistrer un commentaire