0

I am using a Sqlite database, and it crashes but only the first time it is run after it installs.
It is based off of Biff MaGriff's post here

It crashes right when I am trying to create the db, giving me a FileNotFoundException, so it has got to be the copyDataBase() portion

 InputStream myInput = dbhContext.getAssets().open(DATABASE_NAME);     

However, after it crashes, I just open it up and the database is there and running, I just don't understand why it crashes while it creates the db.

Community
  • 1
  • 1
Shant82
  • 53
  • 1
  • 1
  • 4

2 Answers2

1

You're using SqlLiteOpenHelper to help with the difference between "create" and "reopen", aren't you?

http://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper.html

paulsm4
  • 114,292
  • 17
  • 138
  • 190
0

I was using a class that was intended for using a database already created and copied over, so since I didn't need that and only needed one created on first use, I used the helper class off of http://www.screaming-penguin.com/node/7742.

Shant82
  • 53
  • 1
  • 1
  • 4