Apps [SQLite] Stuck for hours trying to figure out how to access database in /assets/

bw91

Lurker
Here's the scenario:

  • I have an app that will load a list of movies from a local SQLite database (& description, release, etc)
  • I'm using the Master Detail Flow template (rather than BlankActivity)
  • I have the SQLite database created and stored in the /assets directory of the project
  • I have a DatabaseManager.java that is suppose to facilitate database actions.

My problem: I'm getting the following error when I would try to open my database:
Failed to open database '/data/data/com.jonny/databases/database'.

Here is my source code: http://www.mediafire.com/download/vxzwiidypi111bt/MovieListActivity.zip (I'd pastebin it, but I'd rather you see the context)

Here is the guide I was using: Android Database Tutorial | My Android Solutions

I'm quite desperate for a solution, close to the point where I would pay a tutor to walk me through it. :thumbup:
 

timcs

Member
Here's the scenario:

  • I have an app that will load a list of movies from a local SQLite database (& description, release, etc)
  • I'm using the Master Detail Flow template (rather than BlankActivity)
  • I have the SQLite database created and stored in the /assets directory of the project
  • I have a DatabaseManager.java that is suppose to facilitate database actions.

My problem: I'm getting the following error when I would try to open my database:
Failed to open database '/data/data/com.jonny/databases/database'.

Here is my source code: MovieListActivity (I'd pastebin it, but I'd rather you see the context)

Here is the guide I was using: Android Database Tutorial | My Android Solutions

I'm quite desperate for a solution, close to the point where I would pay a tutor to walk me through it. :thumbup:

I think the DB_PATH in your case should be [HIGH]/data/data/com.jonny.moviestar/databases/database[/HIGH] as reading the tutorial this is your main package in the android manifest as the example from your link indicates that the main package in that is com.example.

Thanks

TimCS
 

mills2533

Well-Known Member
It would be beneficial for you to familiarize yourself with adb and adb shell so you can look through the directory and files on your phone or emulator depending on which you're using. Then you'd be able to verify where your database was actually installed.
 

alostpacket

Over Macho Grande?
That's not a good tutorial.

Try making your db on the device an populating it with just a few rows in code.

Dont try to add/copy/package a pre-made db
 
Top