I am using an Imageview and a Button in 1 XML, and I am retriving the images as URL from webServer and displaying it on the ImageView. Now if the Button(Save) is clicked I need to save that particular image into SD card. How to do this?
NOTE: Present Image Should be saved.
First, you need to get your Bitmap. You can already have it as an object Bitmap, or you can try to get it from the ImageView such as:
Then you must get to directory (a File object) from SD Card such as:
Next, create your specific file for image storage:
After that, you just have to write the Bitmap thanks to its method compress such as:
Finally, just deal with the boolean result if needed. Such as:
Don’t forget to add the following permission in your Manifest: