0
나는 사용자가 보낸 텍스트를 QR 코드로 변환하고 imageView에 QR 코드를 표시하는 응용 프로그램이 있습니다. 내 문제는 어떻게 내가 그것에 대해 지정된 경로로 이미지를 공유 의도를 사용할 수 있습니다 또는 이미지를 아무 곳에 나 저장됩니다?장치에 저장되지 않은 이미지를 공유하는 방법은 무엇입니까?
나는 사용자가 보낸 텍스트를 QR 코드로 변환하고 imageView에 QR 코드를 표시하는 응용 프로그램이 있습니다. 내 문제는 어떻게 내가 그것에 대해 지정된 경로로 이미지를 공유 의도를 사용할 수 있습니다 또는 이미지를 아무 곳에 나 저장됩니다?장치에 저장되지 않은 이미지를 공유하는 방법은 무엇입니까?
캐시의 이미지 비트 맵을 저장 한 다음 공유하면됩니다.
//To get the bitmap from Imageview
imageView.setDrawingCacheEnabled(true);
Bitmap bitmap = imageView.getDrawingCache();
//To share it via Intent**
try {
File file = new File(getContext().getCacheDir(), fileName + ".png");
FileOutputStream fOut = new FileOutputStream(file);
bitmap.compress(CompressFormat.PNG, 100, fOut);
fOut.flush();
fOut.close();
file.setReadable(true, false);
final Intent intent = new Intent(android.content.Intent.ACTION_SEND);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
intent.setType("image/png");
startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
}
유는 파일 경로를 사용하여 다음 비트 맵을 저장, 공유가 필요 –
http://stackoverflow.com/a/32829056/4265664 – Anu
당신이 더 이상 필요가없는 경우 캔트 당신이 어딘가에 임시로 이미지를 저장하고 삭제 하시겠습니까? – Tirolel