阳光网驿-企业信息化交流平台【DTC零售连锁全渠道解决方案】

 找回密码
 注册

QQ登录

只需一步,快速开始

扫描二维码登录本站

手机号码,快捷登录

老司机
查看: 1239|回复: 0

[转帖] android 彩信(图片,视频)分享加载功能

[复制链接]
  • TA的每日心情
    开心
    2012-3-7 10:15
  • 签到天数: 11 天

    [LV.3]偶尔看看II

    发表于 2012-2-1 11:41:52 | 显示全部楼层 |阅读模式
    [代码] [Java]代码
    private boolean handleSendIntent(Intent intent) {
    Bundle extras = intent.getExtras();
    if (extras == null) {
    return false;
    }
    final String mimeType = intent.getType();
    String action = intent.getAction();
    if (Intent.ACTION_SEND.equals(action)) {
    if (extras.containsKey(Intent.EXTRA_STREAM)) {
    Uri uri = (Uri) extras.getParcelable(Intent.EXTRA_STREAM);               
    boolean wildcard = "*/*".equals(mimeType);
    if (mimeType.startsWith("image/") || (wildcard && uri.toString().startsWith(mImageUri))) {
    setAttachment(1,uri, true);
    } else if (mimeType.startsWith("video/") || (wildcard && uri.toString().startsWith(mVideoUri))) {
    setAttachment(2,uri, true);
    }
    //addAttachment(mimeType, uri, false);
    return true;
    } else if (extras.containsKey(Intent.EXTRA_TEXT)) {
    MessageText.setText(extras.getString(Intent.EXTRA_TEXT));
    return true;
    }
    Toast.makeText(this, getString(R.string.message_too_big_for_video), Toast.LENGTH_SHORT).show();
    }
    楼主热帖
    启用邀请码注册,提高发帖质量,建设交流社区
    您需要登录后才可以回帖 登录 | 注册

    本版积分规则

    快速回复 返回顶部 返回列表