android - My app option in 'share with' from contextual action bar of any app -


i have built dictionary app says find meaning of words.

i have noticed 'share with' option (if present) in contextual action bar of app gives list of apps, selected data can shared.

for ex. in browser on long pressing of text , selecting share in contextual action bar can share 'keep' app create note. want enlist app here user can directly find meaning of selected text.

i understand have implement sort of listener , maybe android autolist app, unable find exact steps. have seen apps other system apps in share option, believe can done app.

could give me directions same.

also there way can recognize unique trigger, example triple click on word in app , fragment of dictionary pops shall contain meaning. know last part not possible achieve still?

add androidmanifest.xml

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

myactivity.java

void oncreate (bundle savedinstancestate) {     ...     // intent, action , mime type     intent intent = getintent();     string action = intent.getaction();     string type = intent.gettype();      if (intent.action_send.equals(action) && type != null) {         if ("text/plain".equals(type)) {             string sharedtext = intent.getstringextra(intent.extra_text);             if (sharedtext != null) {                 // update ui reflect text being shared             }         }      } } 

the complete tutorial can found here:
https://developer.android.com/training/sharing/receive.html


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

node.js - How to abort query on demand using Neo4j drivers -