If i share image one time in gmail and again come back and do some changes and again if i share then only previous image was displaying :( that was the issue with 4.1.1 when i run same problem in 4.2.2 it works perfectly :( :( :(
Hi i what to share image using Intent for that i have used below code
public void otherBtn(View v) {
FileOutputStream out = null;
try {
if (bitmap != null) {
bitmap.recycle();
bitmap = null;
}
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
File sdcard = Environment.getExternalStorageDirectory();
File f = new File(sdcard, "temp.jpg");
if (f.isFile()) {
f.delete();
}
out = new FileOutputStream(f);
captureRelativeLayout.setDrawingCacheEnabled(true);
bitmap = captureRelativeLayout.getDrawingCache(true).copy(
Config.ARGB_8888, false);
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, out);
sharingIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(f)); // imageUri
sharingIntent.setType("image/jpg");
startActivity(sharingIntent);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (out != null) {
try {
out.flush();
out.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
for example when i share below image with above code
the image which i have previously shared will shown but not above updated image is showing :(
You flush and close the stream after starting the activity. You need to do it before to write the file contents properly.