CustomView view= new CustomView(this);
File file = new File("/sdcard/test.png");
FileOutputStream fos = null;
try{
fos = new FileOutputStream(file);
view.buildDrawingCache();
Bitmap bitmap= view.getDrawingCache();
bitmap.compress(CompressFormat.PNG, 72, fos);
}catch(Exception e){
e.printStackTrace();
}finally{
try{
fos.close();
}catch(IOException e){
e.printStackTrace();
}
}
위 소스 처럼 했는데 일단 test.png파일이 생기긴합니다.
그런데 커스텀뷰 내용이 저장되는게 아니라 아무 내용 없는 0kb 파일만 만들어집니다.
어디가 잘못된 걸까요?