【问题标题】:ToUri() not convert all extra in intent (parcelable, serializable, byte[]..)ToUri() 不转换所有额外的意图(parcelable,serializable,byte[]..)
【发布时间】:2017-02-26 20:59:53
【问题描述】:

当我像这样在我的意图中添加一个字节数组时:

Intent 意图 = new Intent("android.intent.action.MAIN" );

捆绑参数 = new Bundle();

ByteArrayOutputStream bs = new ByteArrayOutputStream();

bmp.compress(Bitmap.CompressFormat.PNG, 50, bs);

param.putByteArray("图像",bs.toByteArray());

intent.putExtras(param);

位图神经元的数据出现在编码的uri中:

字符串 uri = intent.toUri(URI_INTENT_SCHEME);

(uri) -> 意图:#Intent;action=android.intent.action.MAIN;launchFlags=0x10000000;component=com.xxxx.xxx/.activity.xxxx;end

提前致谢。

【问题讨论】:

    标签: android android-intent parcelable


    【解决方案1】:

    Intent.toUri() 不支持数组附加项。仅支持以下类型(取自Intent.toUri()的源代码:

                char entryType =
                        value instanceof String    ? 'S' :
                        value instanceof Boolean   ? 'B' :
                        value instanceof Byte      ? 'b' :
                        value instanceof Character ? 'c' :
                        value instanceof Double    ? 'd' :
                        value instanceof Float     ? 'f' :
                        value instanceof Integer   ? 'i' :
                        value instanceof Long      ? 'l' :
                        value instanceof Short     ? 's' :
                        '\0';
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-03-08
      • 2019-01-11
      • 1970-01-01
      • 2012-10-13
      • 2010-12-03
      • 1970-01-01
      相关资源
      最近更新 更多