如何访问现有的sqlite数据库在Android模拟器? [英] How access existing sqlite database on Android Emulator?

查看:156
本文介绍了如何访问现有的sqlite数据库在Android模拟器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



因此,我创建了数据库适配器类,并创建了一个数据库适配器类。我的主要活动类。



我在模拟器中运行没有问题,但如何查看内容?
book im读数说使用DDMS检查Android设备/模拟器的文件系统,数据库在数据库文件夹
下创建,并且在Eclipse中的数据库文件夹下有一个数据库的映像。
我不知道第一部分真正意味着什么(使用DDMS?),不知道人们提到的/ data / data文件夹在哪里。



在Eclipse中运行SQLite3并输入.tables不会生成任何数据库。

解决方案

在Eclipse中打开Perspective >其他> DDMS。导航到数据库,像下面的答案中的图像,选择数据库,然后单击floppydisk图标从右上角的设备中拉取文件。



模拟器,DDMS中的位置应为文件资源管理器选项卡中的/data/data/com.yourNamespace/databases。




这是一个DDMS透视图。在右侧的文件资源管理器选项卡中,您将向下钻取到databases文件夹。这些是虚拟文件夹,所以你不会在你的系统上找到它们。要检查数据库,您需要选择从设备中拉取文件的图标(对不起,它在此屏幕截图中裁剪出来),并在SQLite中打开该文件。


So im new to working with databases in android, and I cant seem to figure out how to view a created database.

I created the database adapter class and in my main activity class.

I run it in the emulator with no issues, but how do I view the contents? The book im reading says "examine the file system of the Android device/emulator using DDMS. The database is created under the database folder" and has an image of the database under a database folder in Eclipse. I dont know what the first part really means (using DDMS?) and have no idea where the /data/data folder is that people mention.

Even running SQLite3 in CMD and typing ".tables" doesn't yield any database.

解决方案

In Eclipse Go to Window > Open Persepective > Other > DDMS. Navigate to the DB like the image from the answer below, select the database then click on the floppydisk icon to pull the file from the device on the top right.

In the emulator, the location in DDMS should be /data/data/com.yourNamespace/databases in the File Explorer tab.

This is a pic of the DDMS perspective. In the File Explorer tab on the right, you would drill down to the databases folder. These are virtual folders, so you won't find them on your system. To examine the db, you would select the icon for Pull file from the device (sorry, it got cropped out in this screenshot) and open that file in SQLite.

这篇关于如何访问现有的sqlite数据库在Android模拟器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆