0

I been trying for few hours just to create a simple database with password..

Here's the code.

//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);
}

The app crashes at the last line of insertPassword():

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

I really don't understand what the problem is.. I've been freaking out for hours trying to figure out what the problem is. Thank you.

idish
  • 3,190
  • 12
  • 53
  • 85
  • Use LogCat to examine the Java stack trace associated with your crash. – CommonsWare Jun 13 '13 at 23:21
  • @CommonsWare Unable to use LogCat with my device after I burned another ROM :( – idish Jun 13 '13 at 23:27
  • Then I fail to see how you plan on doing any Android development with that device. Perhaps you should switch to the x86 emulator, or buy a replacement device. – CommonsWare Jun 13 '13 at 23:35
  • @CommonsWare Alright, thank you. You're right, It is really annoying developing like this. – idish Jun 13 '13 at 23:47
  • I'm sorry my answer sounded like I was yelling at you. It definitely was not how I felt. I was truly trying to assist you. – HalR Jun 15 '13 at 00:12
  • @HalR It's totally fine, I understand. Plus, I was a little bit angry before I commented your answer, sorry for being rude, I'm sure you were just intending to help me. Have a good day :) – idish Jun 15 '13 at 08:09

0 Answers0