On a certain tap event, I ask the user to add an image. So I provide two options:
Note : if you are using android 6.0 or greater version path will give null value.
so you have to add permission
public void onClicked(View view){
Bitmap bitmap=getBitmapFromView(scrollView,scrollView.getChildAt(0).getHeight(),scrollView.getChildAt(0).getWidth());
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG,90,baos);
String path = MediaStore.Images.Media.insertImage(getContentResolver(),bitmap,"title",null);
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("image/jpeg");
intent.putExtra(Intent.EXTRA_STREAM,Uri.parse(path));
startActivity(Intent.createChooser(intent,"Share Screenshot Using"));
}