这是我在按钮点击时共享图像的代码..当我在whatsapp上共享图像时,下载后它将是缩放尺寸。我没有得到任何解决方案。
pagelayout.setDrawingCacheEnabled(true);
pagelayout.buildDrawingCache();
bitmap_one = pagelayout.getDrawingCache();
Intent shareIntent = new Intent(Intent.ACTION_SEND);
// shareIntent.setType("image/jpeg");
shareIntent.setType("image/*");
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
bitmap_one.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream);
File file = new File(Environment.getExternalStorageDirectory() + separator + "ImageDemo.jpg");
try {
file.createNewFile();
FileOutputStream fileOutputStream = new FileOutputStream(file);
fileOutputStream.write(byteArrayOutputStream.toByteArray());
} catch (IOException e) {
e.printStackTrace();
}
// pagelayout.setDrawingCacheEnabled(false);
shareIntent.putExtra(Intent.EXTRA_STREAM, (Uri.fromFile(file)));
shareIntent.putExtra(Intent.EXTRA_TEXT, shareText);
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(shareIntent, "Share Image"));
pagelayout.setDrawingCacheEnabled(false);