开发者

Cropping Picture on Droid X sets resulting image as wallpaper

I'm running into an issue with my program when trying to crop an image selected by the user from their gallery. The issue so far only appears when running on a Droid X, as running on the original moto Droid works fine.

Basically the issue occurs as the cropping intent is being run. Once the user crops the photo and clicks the save button, it replaces the wallpaper on the main screen with the cropped image that was saved! It does not do this on the moto droid, or emulators. Below is the code for cropping and saving the picture to the SD card:

@Override
public void onActivityResult(int requestCode,int resultCode,Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode ==1){
if (resultCode == Activity.RESULT_OK) {
  Intent i = new Intent("com.android.camera.action.开发者_如何学GoCROP");
  i.setData(data.getData());
  i.putExtra("noFaceDetection", true);
  i.putExtra("outputX", 80);
  i.putExtra("outputY", 80);
  i.putExtra("aspectX", 1);
  i.putExtra("aspectY", 1);
  i.putExtra("scale", true);


if(selectedImageString == null){
      ContentValues values = new ContentValues();
      values.put(android.provider.MediaStore.Images.Media.TITLE, "Temp_Icon1");
      values.put(android.provider.MediaStore.Images.Media.BUCKET_ID, "Temp_Icons");
      values.put(android.provider.MediaStore.Images.Media.BUCKET_DISPLAY_NAME,"Temp_Icons");
      values.put(android.provider.MediaStore.Images.Media.IS_PRIVATE, 1);
      selectedImageString = getContentResolver().insert(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values).toString();
  }
  i.putExtra("output", Uri.parse(selectedImageString));
  startActivityForResult(i, 2);
}
}
 if(requestCode == 2){
 if (resultCode == Activity.RESULT_OK){
  uriPath = Uri.parse(selectedImageString);
  imageView.setImageURI(uriPath);
 }
}

}

Can someone please help me with this?


I can verify that the Droid X is doing the same for me even with the "output" option mentioned above. I have found no way around it as of yet and will look at blocking the crop feature for Droid X phones as well. It is ashame it doesn't work here.

By they way, you could try the following...

i.putExtra("return-data", true);

This returns the image in the returned intent. You can access it with the following...

BitMap BM = data.getParcelableExtra("data");

This, however, is not supported by the Galaxy S line of phones. It returns an empty parcel no matter what. So, I have found no good solution yet.


It could be that since you don't specify where to put the data when calling the crop intent that it is overwriting the image.

The crop intent is internal code I think so I'm not sure we can know for sure (the crop intent isn't found on all phones either btw)

When I call the crop intent I pass

i.putExtra("output", croppedOutputUri);


Have you tried placing:

i.putExtra("setWallpaper", false);

I took it from here: https://github.com/lvillani/android-cropimage/blob/master/src/com/android/camera/CropImage.java

theres a library whihc was probably takien from original sources and modified and you can see this attribute set there

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜