public class DBActivities {
private final String tableName = "Table_SMS";
private final String CREATE_TABLE_SMS = "CREATE TABLE " + tableName + "(" + "db_date TEXT " + "db_sms_count INTEGER);";
private SQLiteDatabase db;
public DBActivities() {
DoDBInitialization();
}
private void DoDBInitialization() {
db = openOrCreateDatabase(tableName, 0, null);
db.setVersion(1);
db.setLocale(Locale.getDefault());
db.setLockingEnabled(true);
}
我收到错误消息“未为 DBActivities 类型定义方法 openOrCreateDatabase(String, int, null)”。这里有什么问题?DBActivities 类被主类用于所有与数据库相关的活动。
我做了一些研究,并尝试使用:
db = openOrCreateDatabase(tableName, null, Context.MODE_PRIVATE);
结果还是一样。