简体   繁体   中英

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. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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