Question

I'm having trouble figuring out if I created my database correctly.

I'm trying to locate a .db file to check if database was created successfully but can't find it anywhere in my project explorer, what is correct way to check for database, and it would help to know where such file is located (in project not device) in order to view its data.

Était-ce utile?

La solution

Moved my comment here:

If you're trying to view the db on an actual device, the internal data directory is typically protected. On an emulated device you can (also some rooted phones).

I understand "project explorer" to be the explorer for the source code? You're db does not exist there, the dir/file exist only on the device...this is the code to create the db. As others now have explained, to view the device files in Eclipse, you need to use the DDMS panel.

Autres conseils

It may help you little.

In eclipse>Open perspective>DDMS

in this location you will be able to find all the database files which are related to your application.

If you have a database, sending the

SELECT name FROM sqlite_master WHERE type='table';

query should return a list with all the tables in your database. If instead you get an error or no results, you know something is up.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top