You need to add an intent filter to the operation in question, for example:
<activity android:name=".PostActivity"> <intent-filter> <action android:name="android.intent.action.SEND" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="text/plain" /> </intent-filter> </activity>
Then you just need to process the data sent to you in the intention of your activity
Uri data = getIntent().getData(); Bundle extras = getIntent().getExtras(); String messageText = ""; if (data != null) { messageText = data.toString(); } else if (extras != null) { messageText = extras.getString(Intent.EXTRA_TEXT); }
source share