안드로이드 화면 캡처 예제 소스를 이용해서 화면 캡쳐에는 성공했습니다.
하지만 제 캡쳐된 이미지 파일을 확인해보니 이상하게 캡쳐 되어 있었습니다.
sufaceViewGrid 부분의 영역이 캡쳐가 되지 않는 것이죠....
screen = (LinearLayout)findviewById(R.id.mainscreenview);
String folder = "Pictures/screen";
try {
SimpleDataFormat formatter = new SimplieDataFormat("yyyyMMddHHmmss");
Date currentTime_1=new Date();
String dateString = formatter.format(currentTime_1);
File sdCardPath = Enironment.getExternalStorageDirector();
File dirs=new File(Environment.getExternalStorageDirectory(), folder);
if(!dirs.exists()){
dirs.mkdirs();
}
screen.buildDrawingCache();
Bitmap captureView=screen.getDrawingCache();
FileOutputStream fos;
String save;
try{
save=sdCardPath.getPath()+"/"+folder+"/"+dateString+".jpg";
fos=new FileOutputStream(save);
captureView.compress(Bitmap.CompressFormat.JPEG,1--,fos);
}catch(FileNotFoundException e){
e.printStackTrace();
}
Toast.makeText(getApplicationContext(), dateString+".jpg save", Toast.LENGTH_LONG).show();
}catch(Exception e){
}
이런 식으로 처리했습니다...
screen의 R.id.mainScreenView가 전체 화면 layout인데.. 왜 그 layout의 SurfaceViewGrid 부분
까지 캡쳐가 안되는지... 궁금합니다...
그리고 마지막 의문점...
캡쳐된 이미지가 파일 관리자로 볼때는 보이지만 핸드폰의 사진 관리 어플로는 그림이 보이지가 않네요...
png파일 jpg 파일 등 다양한 파일로 저장해도 보여지직가 않습니다....
원래 이런 것인지 궁금합니다...
마지막으로는 핸드폰 버튼 볼륨 다운+홈키 누르면 스크린샷이 되는데... 이 것을 이용해서 간단하게
화면 캡쳐를 만들수 있는지 궁금합니다... 있다면 예제 부탁드립니다.