public void mOnCaptureClick(View v) {
View rootView = getWindow().getDecorView();

File screenShot = ScreenShot(rootView);
if (screenShot != null) {
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(screenShot)));
}
}

public File ScreenShot(View view) {
view.setDrawingCacheEnabled(true);
Bitmap screenBitmap = view.getDrawingCache();


//Date now = new Date();
//android.text.format.DateFormat.format("yyyy-MM-dd_hh:mm:ss", now);

String filename = "screenshot.png";
File file = new File(Environment.getExternalStorageDirectory() + "/screenshot", filename);
FileOutputStream os = null;
Toast.makeText(getApplicationContext(), "Screenshot captured", Toast.LENGTH_LONG).show();
try {
os = new FileOutputStream(file);
screenBitmap.compress(Bitmap.CompressFormat.PNG, 90, os);
os.close();
} catch (Exception e) {
e.printStackTrace();
return null;
}

view.setDrawingCacheEnabled(false);
return file;
}



이 코드에 문제가있나요