0

我已经尝试了几个小时只是为了创建一个带有密码的简单数据库..

这是代码。

//Activity 1
     SQLiteDatabase.loadLibs(this);
                dbPasswordHelper2 = new DatabaseHelper2(this);
                dbPasswordHelper2.insertPassword(password);


//DatabaseHelper2 Class

    public DatabaseHelper2(Context context) {
      super(context, dbName, null, 1);
      this.context = context;
    }

@Override
public void onCreate(SQLiteDatabase db) {

        String createDBQuery = "CREATE TABLE IF NOT EXISTS " +passwordTableName + "("+password+" TEXT)";
        db.execSQL(createDBQuery);

}
public void insertPassword(String passwordKey)
{

    String totalPass = passwordKey + salt;
    System.out.println(totalPass);
            File databaseFile = context.getDatabasePath(dbName+".db");
            databaseFile.mkdirs();
            databaseFile.delete();
            SQLiteDatabase database = SQLiteDatabase.openOrCreateDatabase(databaseFile, key, null);
}

该应用程序在最后一行崩溃insertPassword()

 SQLiteDatabase database = SQLiteDatabase.openOrCreateDatabase(databaseFile, key, null);

我真的不明白问题是什么。我已经吓坏了好几个小时试图找出问题所在。谢谢你。

4

0 回答 0