English 中文(简体)
Android SQLite路径
原标题:Android SQLite path

我正在一个应用程序中使用SQLite。它写入数据库等,没有任何问题。但是,我找不到这个新数据库。我试过用cd/data/data/packageName/databases更改目录,但它说“没有这样的文件或目录”。此外,当我在eclipse中单击文件资源管理器时,找不到这个数据库。我的日志记录告诉我数据库已经创建,它正在被写入。我想我需要使用adb在shell中设置路径或类似的东西,但我不知道如何做到这一点。有人能给我一些指导吗?此外,我正在使用我的手机进行开发。使用模拟器时,数据库也不会显示。

Thanks very much. Matt

最佳回答

马特,

此线程很好地解释了为什么您可能无法访问手机上的数据文件夹。

无法使用Nexus One访问DDMS文件资源管理器中的数据文件夹

不过,您仍然可以测试Sqlite代码。只需启动一个模拟器。模拟器将没有访问限制。启动后,您可以使用ddms工具(位于android SDK安装文件夹下的tools目录中)。它有一个文件资源管理器,您可以从/data文件夹下载文件。

问题回答

此外,我正在使用我的手机进行开发。

除非通过自己的应用程序代码,否则您无法在标准安卓设备上访问数据库。

您的选择是:

  1. Do this sort of testing on an emulator, in which case you can access the directory that you are failing to access on the device
  2. Add a database backup feature to your app, that copies the (closed) database to external storage, so you can examine it
  3. Root your phone (leastways, I am under the impression this can help get you to this directory -- haven t done it myself)

使用模拟器时,数据库也不会显示。

更加努力。如果您可以使用SQLiteDatabase将数据存储在数据库中并从中读取数据,那么数据库文件就在那里。





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签