English 中文(简体)
1. 启动申请选择并附有适当申请清单
原标题:Android Launching an application chooser with appropriate list of applications
  • 时间:2010-08-16 21:05:29
  •  标签:
  • android

尽管我已经看到了有关这个专题的几处read子和辅导器,但我对如何从申请清单中挑选申请显示档案仍有一些混淆。

我有一份活动清单。 这份清单中包含的是档案途径(即档案浏览器)。 当我们点击特定档案类型时,我需要一份可以打开该档案的申请清单。

到目前为止,这是我在关于项目清单上项目的发言:

Intent myIntent = new Intent();
myIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
myIntent.setAction(Intent.ACTION_VIEW);
myIntent.addCategory("android.intent.category.DEFAULT");
myIntent.setData(Uri.fromFile(new File(filePath)));

When I run this on my phone, the error is: No Activity found to handle Intent { act=android.intent.action.VIEW cat=[android.intent.category.DEFAULT] dat=file:///

当我在档案浏览器申请(从市场卸下)中这样做时,我有两个选择(QuickOffice和Word to Go),我已在我的电话上安装了这两个选择。

难道有人可以指导我,这里还需要什么? 情况 除上述外,我还努力:

  1. 在清单中添加以下条目:

    <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.BROWSABLE" > <category android:name="android.intent.category.DEFAULT" > <data android:scheme="file" /> </intent-filter>

  2. 明确确定类型:

    myIntent.setDataAndType(Uri. FromFile(new file(filePath)),*”;

这两项工作都没有得到任何帮助。

感谢!

问题回答

首先,*不是监测和评价系统类型。 您必须使用<代码>setDataAndType()并提供实际的监测和评价。 如果你不了解实际的监评类型,你就无法建立你的申请。

其次,我将删除<代码>addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)和addCategory(“android.intent. category.DEFAULT”)。 除非你有绝对必要的绝对证据。

第三,对您活动的意图过滤器与任何其他活动的意图过滤器毫不相干,因此,第1号中所尝试的所有过滤器都不重要,而且可能应当删除。





相关问题
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 ...

热门标签