アプリには約10枚の画像があり、それらはサーバーからダウンロードするのではなく、描画可能なリソースにあります。
この画像を共有する必要があります。
次のような解決策があります。ドローアブルをファイルに変換し、保存して、フォルダーからファイルを共有します。
私がSDカードを手に入れたとき、Everethingは外部ストレージで問題ありません。しかし、たとえば(内部ストレージ)Nexus 5を使用している場合、ファイルは保存されますが、フォーマットが異常なため共有されません。
内部ストレージまたはドローアブルからの共有を手伝ってください。
private void shareit()
{
Bitmap icon = BitmapFactory.decodeResource(getResources(), R.drawable.son);
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/jpeg");
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
icon.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
File f;
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) {
// We can read and write the media
f=new File(Environment.getExternalStorageDirectory() + File.separator + "son.jpg");
}
else{
f = new File(getActivity().getApplicationContext().getCacheDir(), "son.jpg");
if(f.exists()){
Log.i("imageExistsInternal", "file is complete");
}
}
if(!f.exists())
f.mkdir();
share.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(f));
startActivity(Intent.createChooser(share, "Share Image"));
}