안드로이드 개발 질문/답변
(글 수 45,052)
현재 뷰 내용을 캡쳐 후 이미지를 카톡같은데로 공유할려고 하는데요
그냥 캡쳐하니깐 캡쳐버튼까지 같이 저장이 되어 버리더군요
내가 보고 있는 화면만 딱 캡쳐하거나 캡쳐한 이후에 원하는부분만 잘라내고 싶은데
무엇을 이용해 어떤부분을 추가 해야 하는건가요?
지금 있는 캡쳐 후 이미지 보내기 소스는 아래와 같습니다.
container.buildDrawingCache();
Bitmap captureView = container.getDrawingCache();
FileOutputStream fos;
try {
fos = new FileOutputStream(Environment.getExternalStorageDirectory().toString()+"/DCIM/capture.jpeg");
captureView.compress(Bitmap.CompressFormat.JPEG, 100, fos);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
Toast.makeText(getApplicationContext(), "Captured!", Toast.LENGTH_LONG).show();
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_SUBJECT, "제목");
Uri uri = Uri.fromFile(new File(Environment.getExternalStorageDirectory().toString()+"/DCIM/capture.jpeg"));
intent.putExtra(Intent.EXTRA_STREAM, uri);
intent.setType("image/*");
startActivity(Intent.createChooser(intent, "이 사진을 공유합니다."));
그냥 캡쳐하니깐 캡쳐버튼까지 같이 저장이 되어 버리더군요
내가 보고 있는 화면만 딱 캡쳐하거나 캡쳐한 이후에 원하는부분만 잘라내고 싶은데
무엇을 이용해 어떤부분을 추가 해야 하는건가요?
지금 있는 캡쳐 후 이미지 보내기 소스는 아래와 같습니다.
container.buildDrawingCache();
Bitmap captureView = container.getDrawingCache();
FileOutputStream fos;
try {
fos = new FileOutputStream(Environment.getExternalStorageDirectory().toString()+"/DCIM/capture.jpeg");
captureView.compress(Bitmap.CompressFormat.JPEG, 100, fos);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
Toast.makeText(getApplicationContext(), "Captured!", Toast.LENGTH_LONG).show();
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_SUBJECT, "제목");
Uri uri = Uri.fromFile(new File(Environment.getExternalStorageDirectory().toString()+"/DCIM/capture.jpeg"));
intent.putExtra(Intent.EXTRA_STREAM, uri);
intent.setType("image/*");
startActivity(Intent.createChooser(intent, "이 사진을 공유합니다."));