2012-07-04 30 views
2

我正在使用Phonegap构建应用程序。 HTML,CSS,JS ...ANDROID - 意图以文件管理器启动应用程序

我想要的应用程序来当用户点击需要文件管理器的东西

我知道,我必须在AndroidManifest中放置一些东西,但我不知道...什么帮助?

另一个例子:比方说,我在我的主屏幕(APEX)上,想要选择一个新的图标。当我点击图标时,会出现一个列表,列出所有可用于查找图标的应用程序。这些应用程序包括Astro,Box,SolidExplorer,Gallery等...我如何让我的应用程序出现在该列表中?

回答

0

你需要这样的intent-filter具体data元素声明你activitymanifest文件。

为前:

<intent-filter> 
    <action android:name="android.intent.action.VIEW" /> 
    <category android:name="android.intent.category.DEFAULT" /> 
    <data android:scheme="file" /> 
    <data android:host="*" /> 
    <data android:pathPattern=".*\\.pdf" /> 
    </intent-filter> 
+1

谢谢!这正是我期待的! – user802609

+0

我该如何调用这个表单js文件..请给我示例代码 – Pradeep

+0

@Pradeep你需要对上述问题做出这个评论,因为OP知道它,我没有使用过这个。 – MKJParekh

0

Intent.ACTION_GET_CONTENT可能会有所帮助。

这里是启动一个文件选择器与图像类型文件的例子。

Intent intent = new Intent(); 
intent.setAction(Intent.ACTION_GET_CONTENT); 
intent.setType("image/*"); // choose any image 
intent.addCategory(Intent.CATEGORY_OPENABLE); 
Intent chooserIntent = Intent.createChooser(intent, "File chooser"); 
startActivityForResult(chooserIntent, REQUEST_CODE); 
+0

嗯。那么我在哪里放这个?有什么我可以放在AndroidManifest来照顾它吗? 就像我之前提到的,我使用的是HTML/CSS/JS的Phonegap Build,所以我不能将Java代码放入其中。我只能编辑Manifest。 – user802609

相关问题