Search code examples
androidgithubimage-capture

How to save processed image in android


I want to know how to save the processed image in a folder. The code is on github. It is a scanner. When the image is croping it will not saving the image. I want to save croped image.

The ResultFragment.java is the file for the output


Solution

  •         OutputStream outStream = null;
            String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new
                    Date());
            File file = new File(ScanConstants.IMAGE_PATH, timeStamp + "crop.jpg");
    
            try {
                outStream = new FileOutputStream(file);
    
                bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outStream);
                outStream.flush();
    
                outStream.close();
            }
            catch(Exception e)
            {}
    

    The file is ResultFragment.java and add the above code inside the private class DoneButtonClickListener implements View.OnClickListener {