Context context = params[0].context;
Bitmap image = params[0].image;
- try{
+ try {
long currentTime = System.currentTimeMillis();
- String date = new SimpleDateFormat("MM-dd-yy-kk-mm-ss").format(new Date(currentTime));
+ String date = new SimpleDateFormat("yyyy-MM-dd-kk-mm-ss").format(new Date(currentTime));
String imageDir = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES).getAbsolutePath();
- String imageFilePath = String.format(SCREENSHOT_FILE_PATH_TEMPLATE,
- imageDir, SCREENSHOTS_DIR_NAME,
- date, currentTime % 1000);
+ String imageFileName = String.format(SCREENSHOT_FILE_NAME_TEMPLATE, date);
+ String imageFilePath = String.format(SCREENSHOT_FILE_PATH_TEMPLATE, imageDir,
+ SCREENSHOTS_DIR_NAME, imageFileName);
// Save the screenshot to the MediaStore
ContentValues values = new ContentValues();