Android - How can I view a sql database created in my app? I'm running it on the Android emulator in Eclipse

后端 未结 3 521

I have an Android application that uses the Android database to create tables and store data. I\'m currently running this app in the emulator in Eclipse. I have 2 questions:

3条回答
  •  抹茶落季
    2020-12-06 03:04

    The database is stored in the following location on the emulator (assuming your app has the package com.example.app and a database named db-name.db):

    /data/data/com.example.app/db-name.db
    

    You can access it from the command line as follows:

    cmd> adb -e shell
    cmd> sqlite3 /data/data/com.example.app/databases/db-name.db
    sqlite> select * from table_name;
    sqlite> 1|Example Item 1|1|
    sqlite> 2|Example Item 2|2|
    sqlite>
    

提交回复
热议问题