Guest User

Untitled

a guest
Aug 25th, 2019
88
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public void saveImageToDownloadFolder(String imageFile, Bitmap ibitmap){
  2. try {
  3. File filePath = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), imageFile);
  4. OutputStream outputStream = new FileOutputStream(filePath);
  5. ibitmap.compress(Bitmap.CompressFormat.PNG, 100, outputStream);
  6. outputStream.flush();
  7. outputStream.close();
  8. Toast.makeText(MainActivity.this, imageFile + "Sucessfully saved in Download Folder", Toast.LENGTH_SHORT).show();
  9. } catch (Exception e){
  10. e.printStackTrace();
  11. }
  12. }
RAW Paste Data