1

I am using the below intent to crop the images selected from gallery or taken by camera:

Intent intent = new Intent("com.android.camera.action.CROP");
intent.setClassName("com.android.camera", "com.android.camera.CropImage");

However I need to add rotate buttons to that screen as well. Is there a way to do that?

Thanks in advance.

ipman
  • 1,212
  • 2
  • 21
  • 29

2 Answers2

4

You can't do this. Because the Activity that you are talking about is not your Activity.

If you really need this, you will have to implement your own cropping functionality. Find the class corresponding to the AOSP cropping class and reuse it as you need it.

Vikram Bodicherla
  • 7,133
  • 4
  • 28
  • 34
0

Try this: Set an onCLickListener on a normal button and perform your rotate function inside it. I don't really know how to rotate but the following could help:

Button rotateButton = (Button)findViewById(R.id.rotate_button);
rotateButton.setOnClickListener(new View.OnClickListener() 
        {
            public void onClick(View v) 
            {
                rotate();
            }
        });

protected void rotate()
    { 
       // see below links for rotating stuff.
    }

Try this, and this for rotating. Hope this helps.

Ghost
  • 3,966
  • 1
  • 25
  • 36
  • but how can i insert that button to an activity that I did not implement? – ipman Jan 23 '12 at 11:17
  • Are you fetching the image from the gallery or taking a new image and then cropping it? Depending on this action, if you're fetching the image from the gallery to crop it, then I don't think you may have to create a new activity for rotate button. I think you can somehow manage to fix it inside the same activity. – Ghost Jan 23 '12 at 11:21
  • I am using the default crop activity on Android like the one in [this](http://stackoverflow.com/questions/1973359/android-crop-an-image-after-taking-it-with-camera-with-a-fixed-aspect-ratio) question – ipman Jan 23 '12 at 11:28
  • Are you using the layout xml like [this](http://developer.android.com/guide/topics/media/camera.html#preview-layout)? – Ghost Jan 23 '12 at 11:37
  • I assumed/presumed you were using one. I'm not really good with Java, hence would like to suggest you the following: Create an xml layout like given in the above link and set an onClickListeners on buttons. One button can have the crop function while the other can have the rotate function. I'm sorry but I don't know any other way of doing/achieving it. – Ghost Jan 23 '12 at 11:44