While doing some R&D I found a code using the following statement
Uri uri = (Uri) getIntent().getExtras().get("android.intent.extra.STREAM");
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?
Thanks in advance.
Happy Coding
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.
Found your answer:
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"
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.
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.
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...
More elaboration:
Here is the relevant section from AndroidManifest.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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With