views:

336

answers:

3
+1  Q: 

Notepad tutorial

This is truly a beginner's question. I installed and successfully ran the notepad tutorials Notepadv1,2,3 and typed in a few notes. Can i import data (manually )from an external text file into the sq lite dbs? I looked in my Notepadv workspace folders but no dbs seem to have been created? I looked for anything with .db extension or named 'data' as specified in the code. Many thanks.

A: 

yes, you should be able to import data directly to the db.

the database files should be located under /data/data/com.android.demo.notepad1/database/data

Russ Bradberry
+2  A: 

The database is stored on the Android device, you won't see it in your Eclipse workspace.

The general location for any SQLite database is /data/data/{PACKAGE_NAME}/databases/{DB_NAME}.

In this case, /data/data/com.android.demo.notepadN/database/data (where N is which exercise you're building).

Keep in mind that the /data partition is only readable by root. If you don't have root access to your device, you won't be able to view anything in this directory.

If you want to import data, you need to write code that does it when your application is first launched. Alternatively, you could bundle your own SQLite database as an asset, then copy it onto the filesystem at first launch.

See this previous question for more information:
http://stackoverflow.com/questions/513084/how-to-ship-an-android-application-with-a-database

Trevor Johns
A: 

Thanks so much. I just need to figure out how to access /data/data/{PACKAGE_NAME}/databases/{DB_NAME I don;t have the Android device, only the emulator. Do I need CYGWIN with root access or is that the wrong question to ask.