I have ImageView and I want to share its image.
Following is my code,
btshare.setOnClickListener(new OnClickListener() {
@Override
imageview.buildDrawingCache();
Bitmap image = mainimg.getDrawingCache();
public Uri getImageUri(Context inContext, Bitmap inImage) {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
inImage.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
String path = Images.Media.insertImage(inContext.getContentResolver(), inImage, "Title", null);
return Uri.parse(path);
}
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/*");
share.putExtra(Intent.EXTRA_STREAM, getImageUri(this,getImageUri));
startActivity(Intent.createChooser(share,"Share via"));