打开文件选择器形成我的Andr​​oid活动 [英] Open file picker form my Android activity

查看:234
本文介绍了打开文件选择器形成我的Andr​​oid活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在做Android应用程序存储设备的SD卡里面的一些下载的PDF文件。
一切工作正常,但现在我想添加一个功能,只是弹出默认的Andr​​oid文件/文件夹浏览器中显示的目录在我的应用程序商店所有的PDF(用它的子目录),从而使用户看到存储自己的文件,其中与可以轻松浏览。

I'm making an Android app which stores some downloaded pdf files inside the device's SD card. Everything works fine, but now I want to add a function to just pop up the default android file/folder browser showing the directory where my app stores all the PDF (with subdirectories in it) so that the user sees where his documents are stored and can easily browse them.

我一直throught许多其他的做题和论坛帖子,但似乎这只能对音乐/影像/联系人/等来完成。基本上是有一个专用浏览系统,但不能与一般的文件浏览。这些文件类型

I've been throught many other SO questions and forum posts, but it seems this can only be done for music/images/contacts/etc. basically those file types which have a 'dedicated browsing system' but not with general file browsing.

实际上,我用这个code:

I'm actually using this code:

File file = new File("/sdcard/MySorgenia/Documenti/");
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
Uri data = Uri.fromFile(file);
String type = "*/*";
intent.setDataAndType(data, type);
startActivity(intent);

但是,这将告诉我一个选择应用程序来完成你的行动有许多应用,如音乐,画廊等,但没有一般目的的一种对话。

But this will show me a "Choose the application to complete your action" dialog with many applications such as "Music" "Gallery" etc, but no general purpose one.

谢谢!

推荐答案

由于Android中没有任何本地应用程序,它可以作为一个文件资源管理器使用,并响应意图键入* / *

Because In android there is no any native application which you can use as a File Explorer and responds to Intent type "*/*"

实现自己的文件资源管理器 code用于此目的。

Implement your own File-Explorer Code for this purpose..

看这两个环节。


  1. <一个href=\"http://$c$c.google.com/p/openintents/downloads/detail?name=FileManager-source-1.0.0.zip&can=1&q=\">openintents

Android的文件 - 探索

这篇关于打开文件选择器形成我的Andr​​oid活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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