I'm taking photo from dialog fragment. And also I need something like startActivityForResult(takePictureIntent, actionCode);
@Override
public void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) {
super.onActivityResult(requestCode, resultCode, imageReturnedIntent);
switch (requestCode) {
case SELECT_PHOTO:
getActivity();
if (resultCode == Activity.RESULT_OK) {
Uri selectedImage = imageReturnedIntent.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };
Cursor cursor = getActivity().getContentResolver().query(selectedImage, filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
setPic();
}
break;
case ACTION_TAKE_PHOTO_B: {
getActivity();
if (resultCode == Activity.RESULT_OK) {
handleBigCameraPhoto();
}
break;
}
}
}
Bu this method is not being called. Are there any method like this which can be used in dialog fragment??
try like this :
to start activity from fragment :
getActivity().startActivityForResult(intent, code);
to get result back in fragment :
in your parent activity (fragment call activity) :
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
fragmentObject
.onActivityResult(requestCode, resultCode, data);
}