Advertisement
Guest User

Untitled

a guest
Aug 25th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement