I am trying to run PhotoStream sample from following link
http://android-developers.blogspot.com/2008/09/android-photostream.html
An alternative is to let the application save the picture first and manually crop it, i.e.:
Intent intentPick = new Intent("com.android.camera.action.CROP");
intentPick.setClassName("com.android.camera", "com.android.camera.CropImage");//TODO fails in Android 2.x
List list = getPackageManager().queryIntentActivities(intentPick, PackageManager.MATCH_DEFAULT_ONLY);
if (list.size() > 0)
{
intentPick.setData(selectedImageCropped);
intentPick.putExtra("outputX", 240);
intentPick.putExtra("outputY", 240);
intentPick.putExtra("aspectX", 1);
intentPick.putExtra("aspectY", 1);
intentPick.putExtra("scale", true);
intentPick.putExtra("noFaceDetection", true);
intentPick.putExtra(MediaStore.EXTRA_OUTPUT, selectedImageCropped);
startActivityForResult(intentPick, PROCESS_IMAGE);
}
else
{
Log.w(Tag, "PHOTO CROPPING IS INDEED NOT SUPPORTED.");
startActivityForResult(new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI), FROM_IMAGE_SELECT);
Toast.makeText(ContactAdder.this, R.string.select_image_from_sdcard_string, Toast.LENGTH_SHORT).show();
}
A success result leads to:
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Activity.RESULT_OK)
{
switch (requestCode)
{
case FROM_IMAGE_SELECT:
selectedImageCropped = Uri.fromFile(new File(Environment.getExternalStorageDirectory(), "TEMP_IMAGE_" + String.valueOf(System.currentTimeMillis()) + ".jpg"));
/** Crop selected image. */
final Intent intentSelect = new Intent("com.android.camera.action.CROP");
intentSelect.setData(data.getData());
intentSelect.putExtra("outputX", 240);
intentSelect.putExtra("outputY", 240);
intentSelect.putExtra("aspectX", 1);
intentSelect.putExtra("aspectY", 1);
intentSelect.putExtra("scale", true);
intentSelect.putExtra("noFaceDetection", true);
intentSelect.putExtra("output", selectedImageCropped);
startActivityForResult(intentSelect, PROCESS_IMAGE);
break;
And then process your cropped image.