将 SD 卡上的文件组织到目录中

发布于 2024-09-03 07:00:35 字数 411 浏览 1 评论 0原文

我在模拟器上的模拟 SD 卡上上传了图像。我通过长按每个图像从浏览器下载它们。

当我在 DDMS 视角中查看文件资源管理器时,我看到它们位于目录 sdcard/download 中。

现在,如果我想下载一些音频文件并在应用程序中使用它们来列出所有音频文件的标题,它们会放在同一目录中吗? (我正在尝试将音频文件从我的计算机手动推送到模拟器)。

这似乎不对。不同类型的媒体文件(图片、音频、视频)不应该放在不同的目录中吗?

另外,想一想,这样的东西和SD卡上的物理目录有什么关系呢?

 Uri mMedia = android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI;

谢谢!

I have images uploaded on the simulated sdcard on my emulator. I downloaded them from the browser, using the long-click on each image.

When I look at the file explorer in the DDMS perspective, I see that they are in the directory sdcard/download.

Now if I want to download some audio files and use them in an app to, say list the title of all audio files, will they go in the same directory? (I am trying to push the audio files manually from my computer to the emulator).

This doesn't seem right. Shouldn't the media files of different types (pictures, audio, video) go into different directories?

Also, thinking this through a little, how is something like this related to the physical directory on the sdcard?

 Uri mMedia = android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI;

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

兮子 2024-09-10 07:00:35

访问媒体内容的正确方法是通过媒体内容提供商 在设备上。

内容提供程序可以轻松地以统一的方式访问数据,无论数据是存储在磁盘(即 /sdcard/...)上还是存储在 SQLite 数据库之类的内容中。内容提供程序通常使用自定义的 Android 特定 content:// URI 方案来公开数据。

要查询给定内容 URI(例如 MediaStore.Images.Media.EXTERNAL_CONTENT_URI)中的内容,请使用 ContentResolver 类。有关如何使用此类的示例可以在整个 SDK 示例和 Android 开源项目 (gitweb)。

另请查看 MediaScannerConnection 类有关触发媒体扫描的信息(填充媒体内容提供商)等。

The correct way to access media content is via the media content providers on the device.

Content providers make it easy to access data in a unified way, whether that data is stored on disk (i.e. /sdcard/...) or in something like a SQLite database. Content providers generally expose data using a custom Android-specific content:// URI scheme.

To query content living at a given content URI (such as MediaStore.Images.Media.EXTERNAL_CONTENT_URI), use the ContentResolver class. Examples on how to use this class can be found all throughout the SDK samples and Android Open Source Project (gitweb).

Also look at the MediaScannerConnection class for information on triggering media scanning (which populates the media content providers), etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文