I use the following code to allow the user to share a bitmap,
try {
File save_dir = Environment.getExternalStorageDirectory();
FileOutputStream out = new FileOutputStream(save_dir
+ "/test.jpg");
final_bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/jpeg");
share.putExtra(Intent.EXTRA_STREAM,
Uri.parse("file:///" + save_dir + "/test.jpg"));
startActivity(Intent.createChooser(share,
getString(R.string.share_dialog_title)));
} catch (Exception e) {
Toast.makeText(mainActivity, "Error in sharing.",
Toast.LENGTH_LONG).show();
}
The problem is that if the device does not have an SD card, the file will not be saved.
Is there any good way to store it in the internal storage, somewhere in other applications you can access it, because saving it in the application data directory will not allow other applications to access it.
Hi
source
share