码迷,mamicode.com
首页 > 移动开发 > 详细

android Intent.ACTION_SEND

时间:2016-05-21 07:45:58      阅读:291      评论:0      收藏:0      [点我收藏+]

标签:

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();
            }
        }
    }
}

 

android Intent.ACTION_SEND

标签:

原文地址:http://www.cnblogs.com/lesliefang/p/5513953.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!