0
在我的项目中,我正确使用库https://www.zetetic.net/sqlcipher/。现在我需要获取数据库的名称。在经典SQLite中,有一个方法getDatabaseName()而不是密码似乎没有它,我该怎么办?你有好主意吗?Android sqlcipher getDatabaseName()
import net.sqlcipher.database.SQLiteDatabase;
import net.sqlcipher.database.SQLiteOpenHelper;
public class DbCrypt extends SQLiteOpenHelper {
private static final String DB_NAME = "data.db";
private static final int DB_VERSION = 1;
private static SQLiteDatabase db = null;
public DbCrypt(Context context) {
super(context, DB_NAME, null, DB_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
DbCrypt.db = db;
...
...
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
我编辑我的职务 – user2847219
我已经尝试插入方法getDatabaseName(),但我仍然有同样的错误,该方法未被调用。查看新图片,我编辑了我的帖子。 – user2847219
@ user2847219:您需要在'get()'上更改您的方法签名以获取'DbCrypt'对象,而不是'SQLiteOpenHelper'类。 – CommonsWare