Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1. String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
  2.         String imageFileName = "PNG_" + timeStamp + "_" + ".png";
  3.         File imageFile = File(getExternalFilesDir(Environment.DIRECTORY_PICTURES), imageFileName);
  4.             OutputStream stream = new FileOutputStream(imageFile);
  5.             bbm.compress(Bitmap.CompressFormat.PNG,100,stream);
  6.             stream.flush();
  7.             stream.close();
  8.         }catch (IOException e) // Catch the exception
  9.             e.printStackTrace();
  10.         }
  11.  
  12.         Uri savedImageURI = Uri.parse(file.getAbsolutePath());
  13.  
  14.         back.setImageURI(savedImageURI);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement