I've tried testing it with the code from the 1st post.
Looks like:
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        intent.putExtra(MediaStore.EXTRA_OUTPUT,
MediaStore.Images.Media.EXTERNAL_CONTENT_URI.toString());
        intent.putExtra("crop", "true");
..
..


If i'm not wrong, this tells the Camera activity to call the crop
activity right after (I also looked at the sources).
It returns the same exception. Which is very odd. It means that the
Camera activity failed to launch the crop activity ?!

BTW - A simple test of trying to set an image to a contact in my
contact list works just fine (with croping).
According to the Android sources, the contacts application is doing
the same thing as me example.

So now I call to Motorola developers, what's your 5-cents?

Thanks



On Jan 27, 5:20 pm, Streets Of Boston <flyingdutc...@gmail.com> wrote:
> mmmm... The name of the action looks good...
>
> In my app, the image-Uri in the setData is different. You use a
> 'file:' uri. In my app, I use a 'content:' uri. Maybe the CROP action
> cannot handle 'file:' uris and can only handle images that are
> inserted into the Images content-provider.
>
> On Jan 27, 9:57 am, GDroid <baron...@gmail.com> wrote:
>
> > That's what I did in the second try.
> > As I mentioned I commented out the the "setClassName" method and got
> > the second exception:
>
> > 01-27 14:15:46.483: ERROR/AndroidRuntime(1813): Caused by:
> > android.content.ActivityNotFoundException: No Activity found to handle
> > Intent { act=com.android.camera.action.CROP dat=file:///sdcard/
> > tmp_contact_1264594532122.jpg (has extras) }
>
> > BTW - Thanks for the quick response.
>
> > On Jan 27, 4:03 pm, zero <zeroo...@googlemail.com> wrote:
>
> > > the activity is not present on all systems under that explicit package
> > > name. try calling it with just the action, leaving out package and
> > > classname in the intent
>
> > > On Jan 27, 1:31 pm, GDroid <baron...@gmail.com> wrote:
>
> > > > Hi,
>
> > > > I'm testing this code on Motorola Milestone (2.0).
> > > > And I get an exception when trying to launch the Cropper:
>
> > > > 01-27 14:29:24.210: ERROR/AndroidRuntime(1895): Caused by:
> > > > android.content.ActivityNotFoundException: Unable to find explicit
> > > > activity class {com.android.camera/com.android.camera.CropImage}; have
> > > > you declared this activity in your AndroidManifest.xml?
>
> > > > When trying the same intent without the setClassName call I get this
> > > > error:
>
> > > > 01-27 14:15:46.483: ERROR/AndroidRuntime(1813): Caused by:
> > > > android.content.ActivityNotFoundException: No Activity found to handle
> > > > Intent { act=com.android.camera.action.CROP dat=file:///sdcard/
> > > > tmp_contact_1264594532122.jpg (has extras) }
>
> > > > Anyone?
>
> > > > Also, there is no Constant for the Crop image intent. Can anyone from
> > > > the Google/Android Framework team explain?
> > > > It seems like it is there to be used but someone forgot to create the
> > > > constant.
>
> > > > Thanks
>
> > > > On Dec 29 2009, 8:30 pm, Wysie <sohyuanc...@gmail.com> wrote:
>
> > > > > Hi all,
>
> > > > > After doing some reading, I realized it can't be done so simply. My
> > > > > modded Contacts source is athttp://github.com/Wysie, you can take a
> > > > > look if you're interested. Also, here's what I did to get it working:
>
> > > > >     private void doTakePhotoAction() {
> > > > >         //http://2009.hfoss.org/Tutorial:Camera_and_Gallery_Demo
> > > > >         
> > > > > //http://stackoverflow.com/questions/1050297/how-to-get-the-url-of-the-...
> > > > >         //http://www.damonkohler.com/2009/02/android-recipes.html
> > > > >         //http://www.firstclown.us/tag/android/
> > > > >         // The one I used to get everything 
> > > > > working:http://groups.google.com/group/android-developers/msg/2ab62c12ee99ba30
>
> > > > >         Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
>
> > > > >         //Wysie_Soh: Create path for temp file
> > > > >         mImageCaptureUri = Uri.fromFile(new File
> > > > > (Environment.getExternalStorageDirectory(),
> > > > >                             "tmp_contact_" + String.valueOf
> > > > > (System.currentTimeMillis()) + ".jpg"));
>
> > > > >         intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT,
> > > > > mImageCaptureUri);
>
> > > > >         try {
> > > > >             intent.putExtra("return-data", true);
> > > > >             startActivityForResult(intent, PICK_FROM_CAMERA);
> > > > >         } catch (ActivityNotFoundException e) {
> > > > >             //Do nothing for now
> > > > >         }
> > > > >     }
>
> > > > >     protected void onActivityResult(int requestCode, int resultCode,
> > > > > Intent data) {
> > > > >         if (resultCode != RESULT_OK) {
> > > > >             return;
> > > > >         }
>
> > > > >         switch (requestCode) {
>
> > > > >         case CROP_FROM_CAMERA: {
> > > > >             //Wysie_Soh: After a picture is taken, it will go to
> > > > > PICK_FROM_CAMERA, which will then come here
> > > > >             //after the image is cropped.
>
> > > > >             final Bundle extras = data.getExtras();
>
> > > > >             if (extras != null) {
> > > > >                 Bitmap photo = extras.getParcelable("data");
>
> > > > >                 mPhoto = photo;
> > > > >                 mPhotoChanged = true;
> > > > >                 mPhotoImageView.setImageBitmap(photo);
> > > > >                 setPhotoPresent(true);
> > > > >             }
>
> > > > >             //Wysie_Soh: Delete the temporary
> > > > > file
> > > > >             File f = new File(mImageCaptureUri.getPath());
> > > > >             if (f.exists()) {
> > > > >                 f.delete();
> > > > >             }
>
> > > > >             InputMethodManager mgr = (InputMethodManager)
> > > > > getSystemService(Context.INPUT_METHOD_SERVICE);
> > > > >             mgr.showSoftInput(mPhotoImageView,
> > > > > InputMethodManager.SHOW_IMPLICIT);
>
> > > > >             break;
> > > > >         }
>
> > > > >         case PICK_FROM_CAMERA: {
> > > > >             //Wysie_Soh: After an image is taken and saved to the
> > > > > location of mImageCaptureUri, come here
> > > > >             //and load thecropeditor, with the necessary parameters
> > > > > (96x96, 1:1 ratio)
>
> > > > >             Intent intent = new Intent
> > > > > ("com.android.camera.action.CROP");
> > > > >             intent.setClassName("com.android.camera",
> > > > > "com.android.camera.CropImage");
>
> > > > >             intent.setData(mImageCaptureUri);
> > > > >             intent.putExtra("outputX", 96);
> > > > >             intent.putExtra("outputY", 96);
> > > > >             intent.putExtra("aspectX", 1);
> > > > >             intent.putExtra("aspectY", 1);
> > > > >             intent.putExtra("scale", true);
> > > > >             intent.putExtra("return-data", true);
> > > > >             startActivityForResult(intent, CROP_FROM_CAMERA);
>
> > > > >             break;
>
> > > > >         }
> > > > >         }
> > > > >     }
>
> > > > > Hope it helps :)- Hide quoted text -
>
> > - Show quoted text -
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to