小编sup*_*hon的帖子

与其他应用分享图片

这是我的问题......我想分享一个png图像.我有可绘制和资产的图像.当我使用sharingIntent它工作但不是我想要的方式.共享的文件显示为数字而没有扩展名,一些应用程序发送消息"未知文件".我能做什么??

这是我的代码:

    Uri uri = Uri.parse("android.resource://com.example.shareimages/" + R.drawable.caja);
    Intent shareIntent = new Intent();
    shareIntent.setAction(Intent.ACTION_SEND);

    shareIntent.setType("image/png");

    shareIntent.putExtra(Intent.EXTRA_STREAM,  uri);

    startActivity(Intent.createChooser(shareIntent, "send"));
Run Code Online (Sandbox Code Playgroud)

我尝试使用而不是可绘制文件,资产中的文件(使用此文件:/// android_asset/...)但它不起作用

android share image

6
推荐指数
1
解决办法
2642
查看次数

标签 统计

android ×1

image ×1

share ×1