I have saved a Bitmap to internal storage with:
private String saveToInternalSorage(Bitmap bitmapImage){
ContextWrapper cw = new ContextWrapper(mContext);
// path to /data/data/yourapp/app_data/imageDir
File directory = cw.getDir("imageDir", Context.MODE_PRIVATE);
// Create imageDir
File mypath=new File(directory,"profile.jpg");
FileOutputStream fos = null;
try {
fos = new FileOutputStream(mypath);
// Use the compress method on the BitMap object to write image to the OutputStream
bitmapImage.compress(Bitmap.CompressFormat.PNG, 100, fos);
fos.close();
} catch (Exception e) {
e.printStackTrace();
}
return directory.getAbsolutePath();
}
And now I want to share it with:
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.putExtra(Intent.EXTRA_STREAM, file);
sharingIntent.setType("image/jpeg");
getContext().startActivity(Intent.createChooser(sharingIntent,"Erfolg teilen!"));
How can I get the Bitmap of the internal Storage and "make it" to a "file", which I can share?
I try to load it with:
ContextWrapper cw = new ContextWrapper(mContext); File directory = cw.getFilesDir(); File file = new File(directory, "profile.jpg");
But this doesn't work it shows no picture if I want to share it (At Facebook it says it couldn't load the image). Is the saving Method correct?