" android.intent.extra.STREAM" [英] "android.intent.extra.STREAM"

查看:176
本文介绍了" android.intent.extra.STREAM"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然做了一些R&安培; DI发现 code 使用下面的语句

While doing some R&D I found a code using the following statement

Uri uri = (Uri) getIntent().getExtras().get("android.intent.extra.STREAM");

我已经扫描了整个项目找到任何其他活动的活动是否是所谓的,但did'nt狼狈不堪。任何一个可以告诉我将这个声明的回报,什么是语句android.intent.extra.STREAM做在code,它是否是一个常数如果有什么是它的价值呢?

I have scanned the whole project to find whether the activity was called from any other activity, but did'nt find any. Can any one tell me what will this statement return and what is the statement "android.intent.extra.STREAM" doing in the code, whether it is a constant, if yes what is its value?

在此先感谢。

编码快乐

推荐答案

这条语句将返回名为android.intent.extra.STREAM多余的。无论活动发出的意图设定值,而且也没有简单的方法来告诉这些数据是没有看到它是如何使用,或在/它是如何设置的。不要忘记,可以通过的任意的活动或应用程序发出的意图。

This statement will return the extra named "android.intent.extra.STREAM". Whatever activity issued the intent set that value, and there's no easy way to tell what that data is without seeing how it is used, or where/how it was set. Don't forget that the intent could be issued by any activity or application.

找到你的答案:

public static final String EXTRA_STREAM                       Since: API Level 1

A content: URI holding a stream of data associated with the Intent, used with 
ACTION_SEND to supply the data being sent.
Constant Value: "android.intent.extra.STREAM"

所以,我断定这是编码很差的结果(利用价值,而不是定义的静态常量)的设计,分享图像的意图。意图包含 Intent.EXTRA_STREAM 额外作为用于图像数据流(在这种情况下)将被共享。海事组织,code的应该的已经:

So, I would posit that it's the result of poor coding (using the value rather than the defined static constant) for an intent designed to share images. The intent includes the Intent.EXTRA_STREAM extra as the data stream for the image (in this case) to be shared. IMO, the code should have been:

Uri uri = (Uri) getIntent().getExtras().get(Intent.EXTRA_STREAM);

但不管,这似乎是附加的二进制数据流,以意图的文件/标准的方式。

But regardless, it appears to be the documented/standardized way of attaching a binary datastream to an intent.

续研究似乎表明,它增加了Campyre(一个营火客户端),其为共享选项。因此,从画廊,如果你选择共享图像,Campyre显示为选项之一。

Continued research seems to indicate that it adds Campyre (a Campfire client) as a "Share" option. So from Gallery, if you choose to Share an image, Campyre shows up as one of the options.

谷歌和的 Android开发网站是你的朋友。我花了所有的约2分钟,共得到所有的信息。不只要走上键入答复和后续的编辑......

Google and the Android dev site are your friends. It took me all of about 2 minutes total to get all that information. Not as long as it took to type the replies and subsequent edits...

详细阐述:

下面是有关节的Andr​​oidManifest.xml

    <activity android:name=".ShareImage"
      android:theme="@android:style/Theme.Dialog"
      android:label="@string/app_name">
      <intent-filter>
        <action android:name="android.intent.action.SEND" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="image/*" />
      </intent-filter>
    </activity>

这表明该活动可以处理意图共享,其中被共享的产品形象。

Which indicates that the Activity can handle Intents for sharing where the item being shared is an image.

这篇关于&QUOT; android.intent.extra.STREAM&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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