Add custom action to Android Share-Sheet -


i have app user should able share text. want provide default sharing options plain text android provides. following code:

intent sendintent = new intent(); sendintent.setaction(intent.action_send); sendintent.putextra(intent.extra_text, text); sendintent.settype("text/plain");  intent chooser = intent.createchooser(sendintent, "share"); startactivity(chooser); 

this bit that:

share dialog source: http://developer.android.com/training/basics/intents/sending.html

but able have 1 more option in share-service-picker dialog triggers custom action in own code. namely want user able favourite entry. beside sharing via sms, email, fb, whatever, i'd there 1 more item on top of list, saying "add favourites" (including icon if possible).

so question if that's possible?!? , if, how :)

any tips appreciated!

intent filters inform system intents application component willing accept. similar how constructed intent action action_send in sending simple data other apps lesson, create intent filters in order able receive intents action. define intent filter in manifest, using element. example, if application handles receiving text content, single image of type, or multiple images of type, manifest like:

<activity android:name=".ui.myactivity" >     <intent-filter>         <action android:name="android.intent.action.send" />         <category android:name="android.intent.category.default" />         <data android:mimetype="image/*" />     </intent-filter>     <intent-filter>         <action android:name="android.intent.action.send" />         <category android:name="android.intent.category.default" />         <data android:mimetype="text/plain" />     </intent-filter>     <intent-filter>         <action android:name="android.intent.action.send_multiple" />         <category android:name="android.intent.category.default" />         <data android:mimetype="image/*" />     </intent-filter> </activity> 

from receiving simple data other apps:update manifest


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -