2013-11-23 3 views

답변

0

Android 4.3 crop gallery resultCode Cancel

방금이 같은 라이브러리를 사용하는 것으로 간주 적이 확인이 : https://github.com/biokys/cropimage

내가 찾아 com.android.camera.action.CROP 때때로 다르게 동작 할 수 있습니다 전화에서 전화로 항상 사용할 수있는 것은 아니므로 릴리스하려는 경우 문제가 발생할 수 있습니다.

UPDATE :

내가 안드로이드 4.3 위의 라이브러리를 테스트 한이 문제없이 작동합니다. 프로젝트에 라이브러리를 추가하기 만하면됩니다.

그런 다음 매우 유사한 방식으로 방법을 쓸 수 있습니다 :

private void performCrop(Uri picUri) { 
//you have to convert picUri to string and remove the "file://" to work as a path for this library 
String path = picUri.toString().replaceAll("file://", ""); 

try { 
    int aspectX = 750; 
    int aspectY = 1011; 

    Intent intent = new Intent(this, CropImage.class); 
    //send the path to CropImage intent to get the photo you have just taken or selected from gallery 
    intent.putExtra(CropImage.IMAGE_PATH, path); 

    intent.putExtra(CropImage.SCALE, true); 

    intent.putExtra("aspectX", aspectX); 
    intent.putExtra("aspectY", aspectY); 

    intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(mCurrentPhotoPath))); 

    startActivityForResult(intent, CROP); 
} 
catch (ActivityNotFoundException anfe) { 
    String errorMessage = "Your device doesn't support the crop action!"; 
    Toast toast = Toast.makeText(this, errorMessage, Toast.LENGTH_SHORT); 
    toast.show(); 
} 

}

+0

그래요 당신이 mentioned.But했다 도서관에 있어요 내가 이름을 얻는 방법을 알고 싶어요 안드로이드 장치에서 사용하는 "기본 작물 기능"을 구현하는 것이 좋습니다. –

+0

그들이 수행하는 작업에 따라 특정 클래스 패키지를 찾는 방법이 있는지 확실하지 않습니다. 이미지 URI에 "ACTION_VIEW"를 사용하거나 "image/*"와 함께 유형을 지정하면 열거 나 조작 할 수있는 모든 옵션이 나열됩니다. – vinaykumar

+0

"자르기"에 대한 다른 시간을 호출하지 않고 양식 갤러리 나 카메라에서 이미지를 선택하는 동안 이미지 자르기 옵션을 설정할 수도 있습니다. – vinaykumar

관련 문제