Private void storeInSD (Bitmap bitmap1 ){
File file = new File (FILE_DIR );
If (! File. exists ()){
File. mkdir ();
}
File imageFile = new File (file, FileUtils. getFileName () + ". png ");
Try {
ImageFile. createNewFile ();
FileOutputStream fos = new FileOutputStream (imageFile );
Bitmap1.compress (CompressFormat. PNG, 50, fos );
Toast. makeText (MainActivity. this, "saved successfully! ", 1 );
Fos. flush ();
Fos. close ();
} Catch (FileNotFoundException e ){
E. printStackTrace ();
Toast. makeText (MainActivity. this, "failed to save! ", 1 );
} Catch (IOException e ){
// TODO Auto-generated catch block
E. printStackTrace ();
Toast. makeText (MainActivity. this, "failed to save! ", 1 );
}
}
Public static String getCharacterAndNumber (){
String rel = "";
SimpleDateFormat formatter = new SimpleDateFormat ("yyyyMMddHHmmss ");
Date curDate = new Date (System. currentTimeMillis ());
Rel = formatter. format (curDate );
Return rel;
}
Public static String getFileName (){
// Mu
// String fileNameRandom = getCharacterAndNumber (8 );
String fileNameRandom = getCharacterAndNumber ();
Return fileNameRandom;
}