I am using library http://ift.tt/1k9Qin5 and not being able to get the cropped image i dont know why below is some code that i am following from documentation
_Profile_Image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,
"Select Picture"), SELECT_PICTURE_FROM_GALARY);
}
});
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent result) {
if (resultCode == Activity.RESULT_OK) {
if (requestCode == SELECT_PICTURE_FROM_GALARY) {
beginCrop(result.getData());
}
}
if (requestCode == Crop.REQUEST_PICK && resultCode == Activity.RESULT_OK) {
beginCrop(result.getData());
} else if (requestCode == Crop.REQUEST_CROP) {
handleCrop(resultCode, result);
}
}
private void beginCrop(Uri source) {
Uri outputUri = Uri.fromFile(new File(getActivity().getCacheDir(), "cropped"));
new Crop(source).output(outputUri).asSquare().start(getActivity());
}
private void handleCrop(int resultCode, Intent result) {
if (resultCode == Activity.RESULT_OK) {
_Profile_Image.setImageURI(Crop.getOutput(result));
} else if (resultCode == Crop.RESULT_ERROR) {
Toast.makeText(getActivity(), Crop.getError(result).getMessage(), Toast.LENGTH_SHORT).show();
}
}
i am able to open the corp activity and it also crops the image and showing saving picture, but the problem is that after cropping image it is not coming in onActivityResult so that i can handle the crop image. I Dont know what i am doing wrong in the code , I am just following the documentation
Help will be Appreciated Thanks.
Aucun commentaire:
Enregistrer un commentaire