English 中文(简体)
如何对浏览器的意图作出反应?
原标题:how to react to an intent of the browser?
  • 时间:2010-07-14 20:18:47
  •  标签:
  • android

Yo guys。

你们知道浏览器的选用/更多/共享页什么? 我很喜欢用地雷进行的活动,以显示能够应对这种浏览器意图的所有器具。 如何在清单中写明意向过滤器。 另外,我如何获得像URL这样的数据以及本意中本应增加的网页名称?

卡车

问题回答

现在我可以肯定地测试这一点,但我认为,你可以通过使用以下代码来登记为一种SEND意图过滤器,然后你应当作为提供者展示。

<intent-filter android:label="@string/app_name">
    <action android:name="android.intent.action.SEND" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="text/plain" />
</intent-filter>

之后,案文从外推。

Intent callingIntent = getIntent();
String url = callingIntent.getStringExtra(Intent.EXTRA_TEXT);

我也建议查看,以便看到支持的圆形型式和超高价值配对。

摘自行动文件:

投入:数据采集是监测、监测和评价的类型。 • 能够拥有一个包含将要发送的数据的EXTRA_TEXT或EXTRA_STREAM现场。 如果使用EXTRA_TEXT,则监理处的类型应为“文字/解释”;否则,它应当是EXTRA中的数据的监测和评价类型。 STREAM。 如果监评类型不明确,则使用<>>>/em>(这只能允许能够处理通用数据流的发送器)。

某些接受者可能酌情解释的任择标准外在:EXTRA_EMAIL, EXTRA_CC, EXTRA_BCC, EXTRA_SUBJECT。





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