简体   繁体   English

将您自己的项目挂接到“共享列表”

[英]Hook in your own item to the “share-list”

When you take a picture or looks at one in the album, there is a "share-button" visible. 当您拍照或查看相册中的一张照片时,会出现一个“共享按钮”。 Is it possible to hook-in your own item to that list, so I can share the picture via my own app? 是否可以将您自己的商品挂接到该列表,以便我可以通过自己的应用分享图片? If so, how do I do that? 如果是这样,我该怎么做?

Try implementing an activity that responds to an ACTION_SEND Intent for whatever image MIME types you want. 尝试针对任何所需的图像MIME类型实现一个响应ACTION_SEND Intent的活动。 In this sample app , I respond to plain text files: 此示例应用程序中 ,我响应纯文本文件:

<activity android:label="@string/app_name" android:name="FauxSender" android:theme="@android:style/Theme.Translucent.NoTitleBar">
  <intent-filter android:label="@string/app_name">
    <action android:name="android.intent.action.SEND"/>
    <data android:mimeType="text/plain"/>
    <category android:name="android.intent.category.DEFAULT"/>
  </intent-filter>
</activity>

Basically you need to "register an intent" to have your app show up in the share list. 基本上,您需要“注册一个意图”才能使您的应用程序显示在共享列表中。 Then you need to write the code (activity) to handle what you wanna do. 然后,您需要编写代码(活动)来处理您想做的事情。 Here's another example I made that will show up for pictures and let you upload your pic to a website: http://eggie5.com/8-hook-share-picture-via-menu-android 这是我制作的另一个示例,该示例将显示图片,并让您将图片上传到网站: http : //eggie5.com/8-hook-share-picture-via-menu-android

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM