I have already tried some code from stack overflow. link mention below
How to save image in android gallery
But that answer is not working on my project. Please help me to find out a solution.
I designed two buttons in the application one for saving images and one for share images.
I have tried a code for download the images.but this code showing me nothing.
imageView.setDrawingCacheEnabled(true);
Bitmap b = imageView.getDrawingCache();
MediaStore.Images.Media.insertImage(context.getContentResolver(), b ,"image", "image decsription");
Now I want to share the same image with the intent. I tried this code but it is showing me
unable to attach media file
my code is below..
private void createShareIntent(){
Intent shareIntent=new Intent(Intent.ACTION_SEND);
shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shareIntent.setType("image/*");
shareIntent.putExtra(Intent.EXTRA_STREAM,mImageUrl);
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
shareIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
startActivity(Intent.createChooser(shareIntent,"Send "));
}
Please help me to find a solution. Thanks in advance.