캡처한 이미지 캡처 및 공유를 구현하고 싶습니다. (I want to implement capture and sharing captured image)


문제 설명

캡처한 이미지 캡처 및 공유를 구현하고 싶습니다. (I want to implement capture and sharing captured image)

뷰를 이미지로 캡처하여 공유하고 싶습니다. 내 코드는 오류 없이 실행됩니다. 공유 부분은 잘 되는데 캡쳐가 안되네요. 어떤 도움이든 환영합니다.

여기에 내가 사용하는 코드가 있습니다.

linel1.buildDrawingCache();
Bitmap captureView = linel1.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,  "title");
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, "This picture is shared"));

참조 솔루션

방법 1:

I think you forget linel1.setDrawingCacheEnabled(true) before linel1.buildDrawingCache();

You can read more about drawing cache in this answer on SO.

(by Jongmin Parksonic)

참조 문서

  1. I want to implement capture and sharing captured image (CC BY‑SA 2.5/3.0/4.0)

#capture #share #Android






관련 질문

Java 제네릭: 캡처를 사용한 컴파일 실패 (Java generics: compilation failure using captures)

Python 함수 호출에서 stdout 출력을 캡처하는 방법은 무엇입니까? (How to capture stdout output from a Python function call?)

캡처한 이미지 캡처 및 공유를 구현하고 싶습니다. (I want to implement capture and sharing captured image)

Ambilight용 Python 화면 캡처(더 적은 리소스 집약적) (Python Screen Capture for Ambilight (less resource intensive))

Windows에서 "비디오 컨트롤러"에 대한 Java 액세스 (Java Access To "Video Controller" In Windows)

libpcap으로 PPP 패킷을 스니핑하는 방법은 무엇입니까? (How to sniff PPP packet with libpcap?)

DVB-T 스틱에서 AVI 파일로 캡처하는 방법 (How to capture from a DVB-T Stick to an AVI-File)

xlib를 사용하여 키 누름 이벤트 캡처 (capture key press event using xlib)

앱에서 HTTPS 트래픽을 캡처하고 싶지만 작동하지 않습니다. (I want to Capture HTTPS Traffic from app but it does not work)

Selenium-wire Python을 사용하여 네트워크 트래픽을 캡처하는 동안 다른 형식의 로그 보기 (Seeing logs in a different format while capturing network traffic using selenium-wire python)

Android 애플리케이션의 특정 프레임 내 자동 촬영 기능 (Auto picturing feature within specific frame in Android application)

안드로이드 스튜디오 캡처 이미지 더 빠르게 (android studio capture image faster)







코멘트