java - Got this error : This class should provide a default constructor for dbHelper -
package com.mytelco.ahliang125.mytelco; import android.content.context; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper; /** * created ahliang125 on 4/29/2015. */ public class dbhelper extends sqliteopenhelper { //databaserecord public static final string database_create_record = "create table " + databaserecord.database_table_record + " (" + databaserecord.key_id + " integer primary key autoincrement, " + databaserecord.name + " text not null, " + databaserecord.title + " text not null, " + databaserecord.link + " text not null," + databaserecord.remark + " text not null, " + databaserecord.priority + " text not null, " + databaserecord.username + " text not null);"; //databaserecord public static final string database_create_user = "create table " + databaseuser.database_table_user + " (" + databaseuser.key_id + " integer primary key autoincrement, " + databaseuser.username + " text not null, " + databaseuser.password + " text not null);"; //version number upgrade database version //each time if add, edit table, need change //version number. public static final int database_version = 3; //databaserecord table public static final string database_table_record = "mytelco_databaserecord"; // databaserecord name public static final string database_name_record = "mytelco_databaserecord"; //databaseuser table public static final string database_table_user = "mytelco_databaseuser"; // databaseuser name public static final string database_name_user = "mytelco_databaseuser"; //databaserecord path public static final string database_path = "/data/data/com.example.ahliang125.mytelco/databases/"; public static final string key_id = "_id"; public static final string name = "name"; public static final string title = "title"; public static final string link = "link"; public static final string remark = "remark"; public static final string priority = "priority"; public static final string username = "username"; public static final string password = "password"; /*public dbhelper(context context, string name, sqlitedatabase.cursorfactory factory, int version) { super(context, name, factory, version); }*/ @override public void oncreate(sqlitedatabase sqlitedatabase) { //all necessary tables create create here sqlitedatabase.execsql(database_create_record); sqlitedatabase.execsql(database_create_user); } @override public void onupgrade(sqlitedatabase sqlitedatabase, int i, int i2) { sqlitedatabase.execsql("drop table if exists " + databaserecord.database_table_record); oncreate(sqlitedatabase); } public dbhelper(context context) { super(context, "mytelco_database.db", null, database_version); } /* //---opens database--- public dbhelper open() { db = dbhelper.getwritabledatabase(); return this; } //---closes database--- public void close() { dbhelper.close(); }*/ }
this happens when try sign apk upload google play store. google few hours , tried solutions still same error. help!i know there no default constructor sqliteopenhelper , need call explicit constructor.
i think happened because don't have constructor super class http://developer.android.com/reference/android/database/sqlite/sqliteopenhelper.html
try add sqliteopenhelper(context context, string name, sqlitedatabase.cursorfactory factory, int version)
, sqliteopenhelper(context context, string name, sqlitedatabase.cursorfactory factory, int version, databaseerrorhandler errorhandler)
public dbhelper(context context, string name, sqlitedatabase.cursorfactory factory, int version) { super(context, name, factory, version); }
and same other constructor
Comments
Post a Comment