문제

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.

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top