Hi I know there is so much question related to this but still i can not find right way :(
I read this link onActivityResult is not being called in Fragment but i can not find the solution.
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, ""),
PICK_IMAGE);
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode != Activity.RESULT_CANCELED) {
if (requestCode == PICK_IMAGE && data.getData() != null) {
imagePath = getAbsolutePath(data.getData());
imageLoader.loadImage("file://" + imagePath,
new ImageLoadingListener() {
@Override
public void onLoadingStarted(String imageUri,
View view) {
}
@Override
public void onLoadingFailed(String imageUri,
View view, FailReason failReason) {
}
@Override
public void onLoadingComplete(String imageUri,
View view, Bitmap loadedImage) {
height = loadedImage.getHeight();
width = loadedImage.getWidth();
if (Utils
.validateImageSize(height, width,
getActivity(),
"Image size must be in 480 (width) & 800 (height) with PNG or JPG format"))
imageLoader.displayImage("file://"
+ imagePath, ivSubmitImgWord,
options);
}
@Override
public void onLoadingCancelled(String imageUri,
View view) {
}
});
}
}
}
when i choose image from gallery sometimes onActivityResult is not call and Fragment is close.please anybody can help me to solve this problem.