I\'m trying to share images with Facebook, twitter, etc using SHARE INTENT
from Android.
I found code to send a image to the share intent, but this code
The above solution uses media store and stores the image in the users main image folder making it viewable through the gallery/photo viewer. This solution will store it as a temporary file in your apps data. In this example inImage is a Bitmap and title is a string for the name of the image file.
File tempDir= Environment.getExternalStorageDirectory();
tempDir=new File(tempDir.getAbsolutePath()+"/.temp/");
tempDir.mkdir();
File tempFile = File.createTempFile(title, ".jpg", tempDir);
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
inImage.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
byte[] bitmapData = bytes.toByteArray();
//write the bytes in file
FileOutputStream fos = new FileOutputStream(tempFile);
fos.write(bitmapData);
fos.flush();
fos.close();
return Uri.fromFile(tempFile);