0

I picked and image from gallery using ACTION_PICK intent and then opened it using com.android.camera.action.CROP intent, it worked fine. But when I overwritten that image file with another image and then opened CROP activity it was still showing previous image(image before overwriting file).

Similar problem occurred with me when I used ACTION_VIEW to preview overwritten image in gallery, the gallery image thumbnail and preview was not updated. So i used

File f=new File(getWorkingDirectory() + File.separator +  "temp.jpg");
tempFile=Uri.fromFile(f);    
Intent mediaScanIntent=new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
mediaScanIntent.setData(tempFile);
parentClass.sendBroadcast(mediaScanIntent);

and this solved the problem for gallery(but not for crop activity).

My question is how should I tell crop activity that image has changed(overwritten completely with a new image), so that when I call again startActivityForResult() for CROP action it displays overwritten image.

Please help me. I am stuck!

prodev
  • 575
  • 5
  • 15
  • com.android.camera.action.CROP is not a official android intent. It is not guarenteed to work in all circumstances so try some image cropping library – Illegal Argument Jun 16 '14 at 04:03
  • @IllegalArgument thanks for your suggestion but still I want to solve this problem. – prodev Jun 16 '14 at 07:40

1 Answers1

1

com.android.camera.action.CROP is not official android intent. Apps like gallery and camera support it but there are many devices where this intent is not supported. here. Have a look at this blog post by @commonsware. I have answered cropping image using a library in this SO post.

Community
  • 1
  • 1
Illegal Argument
  • 10,090
  • 2
  • 44
  • 61
  • 1
    Thanks a lot. simple-image-crop-lib works fine. By the way‚ it uses MIT license‚ so do I need to mention it everywhere where I use this library? – prodev Jun 16 '14 at 10:52