Hi I am using viewPager with fragmnets inside main fragment. I am trying to get image to bitmap from gallery or from camera, but after picking photo and startActivityForResult it doesn't catch in onActivityResult...
here is how i call startActivityForResult:
private void setAvatarDialog(){
final CharSequence[] options = {"Choose from Gallery", "Take Photo" };
String title = getString(R.string.alertDialog_editProfile_updateAvatar_title);
String negative = getString(R.string.alertDialog_editProfile_updateAvatar_negative);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(title);
builder.setItems(options, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (options[which].equals(options[0])) {
mIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
mIntent.setType("image/*");
startActivityForResult(Intent.createChooser(mIntent, "Select File"), SELECT_FILE);
} else if (options[which].equals(options[1])) {
mIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(mIntent, REQUEST_CAMERA);
}
dialog.dismiss();
}
});
builder.setNegativeButton(negative, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
builder.show();
}
and here is my onActivityResult:
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Activity.RESULT_OK){
if (requestCode == REQUEST_CAMERA){
resultCamera(data);
} else if (requestCode == SELECT_FILE) {
resultGallery(data);
}
}
}
any ideas, please?