Search code examples
androidandroid-intentshare-intent

while sharing image via share intent hangout shows old image inside image preview screen in android


while sharing image via android share intent hangout shows old image inside image preview screen which appears before sending image,but whatsapp and facebook shows cuurently selected image itself,

even it shows wrong image in preview ater clicking send, in chat correct image will only be displayed.

 Intent intent = new Intent(Intent.ACTION_SEND);
            intent.setType("image/png");
            intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
            intent.putExtra(Intent.EXTRA_STREAM, uri);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
            startActivity(Intent.createChooser(intent, "Share news via.."));

can any one help with this issue


Solution

  • I found reason behind this issue, i was giving same name everytime to store and share the image, by defalut hangout image send preview screen will display old image , if image name is same. so changing image name everytime will fix the issue.