Android - Sqlite database method undefined fot type
Date : March 29 2020, 07:55 AM
hope this fix your issue I suggest you use the SQLiteOpenHelper. It cares automatically to create a DB if it's not available... public class DatabaseHelper extends SQLiteOpenHelper {
private static final int DB_VERSION = 1;
private static final String DB_NAME = "myDB.db";
public DatabaseHelper(Context ctx) {
super(ctx, DB_NAME, null, DB_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
String query = "CREATE TABLE myTable(_id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, age INTEGER NOT NULL)";
db.execSQL(query);
db.close();
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
...
}
}
...
DatabaseHelper helper = new DatabaseHelper(context);
SQLiteDatabase db = helper.getWritableDatabase();
...
String query = "YOUR SQL STATEMENT";
db.execSQL(query);
db.close();
|
Android DatabaseHelper Error. Cursor doesn't open same table again
Date : March 29 2020, 07:55 AM
Hope that helps Don't close the Cursor & DB object in getAllRectorValues & getAllStudentValues. res.close() will
|
Android SQLite DatabaseHelper unknown error (code 14): Could not open database
Date : March 29 2020, 07:55 AM
I wish this helpful for you There is no need to check if the database exists in onCreate(). You can assume that : The database exists It is opened in read-write mode onConfigure() has been called You are in a transaction
|
Android database manager and inner DatabaseHelper class
Date : March 29 2020, 07:55 AM
|
Android Studio E/dalvikvm﹕ Could not find class '.DatabaseHelper', referenced from method .DatabaseManager
Date : March 29 2020, 07:55 AM
|