发送有意向的用户选择Android上的一个文件 [英] Send an Intent for the user to select a file on Android

查看:138
本文介绍了发送有意向的用户选择Android上的一个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有在Android中处理文件的打开默认的活动?例如在Quickoffice,你可以打开一个文件,但它不会让你浏览目录。这可能是要求一个老派的类型,但在我开发一个应用程序,我想送一个Intent要求用户选择一个文件。那么我的应用程序将处理文件。

理想情况下,这将最终作为用于服务的设置结构,将被其他应用程序使用。

编辑:我浏览的文档在的http://开发商.android.com /引导/主题/数据/数据​​storage.html 的,但对我来说,我要存储和检索不适合在任何类别的数据:


  • 音乐/ - 媒体扫描仪分类所有媒体发现这里作为用户音乐

  • 播客/ - 媒体扫描仪分类所有媒体发现这里作为一个播客

  • 铃声/ - 媒体扫描仪分类所有媒体发现这里作为铃声

  • 报警/ - 媒体扫描仪分类所有媒体发现这里的报警声

  • 通知/ - 媒体扫描仪分类所有媒体发现这里作为一个通知音

  • 图片/ - 所有的照片(不包括用相机拍摄)

  • 电影/ - 所有电影(不包括那些用摄像机拍摄的)

  • 下载/ - 其他下载


解决方案

  

有没有在Android中处理文件的打开默认的活动?


对于由 MediaStore 管理​​的文件类型(例如,MIME类型音频/ * ), ACTION_PICK 的作品。对于任意文件,没有。

Is there a default activity in Android that handles the opening of files? For example in Quickoffice, you can open a file, but it doesn't allow you to navigate directories. This might be an old-school type of request, but in an application I'm developing, I want to send an Intent to request the user to select a file. My application will then process that file.

Ideally, this will end up as a Settings configuration for a service that will be used by other applications.

Edit: I'm browsing the documentation at http://developer.android.com/guide/topics/data/data-storage.html, but in my case, I want to store and retrieve data that doesn't fit in any of the categories:

  • Music/ - Media scanner classifies all media found here as user music.
  • Podcasts/ - Media scanner classifies all media found here as a podcast.
  • Ringtones/ - Media scanner classifies all media found here as a ringtone.
  • Alarms/ - Media scanner classifies all media found here as an alarm sound.
  • Notifications/ - Media scanner classifies all media found here as a notification sound.
  • Pictures/ - All photos (excluding those taken with the camera).
  • Movies/ - All movies (excluding those taken with the camcorder).
  • Download/ - Miscellaneous downloads.

解决方案

Is there a default activity in Android that handles the opening of files?

For the types of files managed by MediaStore (e.g., MIME type audio/*), ACTION_PICK works. For arbitrary files, no.

这篇关于发送有意向的用户选择Android上的一个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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