当前位置: 代码迷 >> 综合 >> 通过系统分享,分享imageview图片的一种方法
  详细解决方案

通过系统分享,分享imageview图片的一种方法

热度:61   发布时间:2024-01-20 01:40:59.0

通过系统分享,分享imageview图片的一种方法


Drawable mDrawable = myImageView1.getDrawable();
Bitmap mBitmap = ((BitmapDrawable)mDrawable).getBitmap();
String path = MediaStore.Images.Media.insertImage(getContentResolver(), mBitmap, "Image I want to share", null);
Uri uri = Uri.parse(path);
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
shareIntent.setType("image/*");
startActivity(Intent.createChooser(shareIntent, "Share Image"));

连接出处