//先在AndroidManifest.xml中添加Intent Filter
android:name="ShareActivity">
android:name="android.intent.action.SEND"/>
android:name="android.intent.category.DEFAULT"/>
android:mimeType="text/plain"/>
android:mimeType="image/*"/>
//在自己的Activity里处理Intent
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Get the intent that started this activity
Intent intent = getIntent();
Uri data = intent.getData();
// Figure out what to do based on the intent type
if (intent.getType().indexOf("image/") != -1) {
// Handle intents with image data ...
} else if (intent.getType().equals("text/plain")) {
// Handle intents with text ...
}
}