android Intent.ACTION_SEND

ACTION_SEND intent 可以把自己的应用添加到系统的发送(分享)列表中。

<intent-filter>
    <action android:name="android.intent.action.SEND" />

    <data android:mimeType="image/*" />

    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

接收和处理如下:

Intent intent = getIntent();
if (intent.getAction().equals(Intent.ACTION_SEND)) {
    Bundle bundle = intent.getExtras();
    if (bundle != null) {
        Uri uri = (Uri) bundle.get(Intent.EXTRA_STREAM);
        if (uri != null) {
            try {
                bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), uri);
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}

 

posted @ 2016-05-21 07:06  LeslieFang  阅读(1805)  评论(0编辑  收藏  举报