Thanks guys for all the help.
I've got a Fragment
with code that allows user to take a photo. After photo gets taken other actions take place. My problem is that these other actions don't get initiated.
Here's the code. I never receive the "Photo Taken" message in LogCat.
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if(requestCode == TAKE_PHOTO_CODE) {
if(resultCode == Activity.RESULT_OK) {
Log.i("Debug", "Photo Taken");
}
}
}
I tried changing Activity.RESULT_OK
to MainActivity.this
, MainActivity
and getActivity()
, but no use.
Take photo code:
centCamera.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
count++;
file = dir+count+".jpg";
currentPhotoString = file;
File newfile = new File(file);
try {
newfile.createNewFile();
} catch (IOException e) {}
Uri outputFileUri = Uri.fromFile(newfile);
Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
startActivityForResult(cameraIntent, TAKE_PHOTO_CODE);
someMethod();
Handler handler = new Handler();
handler.postDelayed(new Runnable(){
@Override
public void run(){
sideCamera.setEnabled(true);
sideCamera.setVisibility(View.VISIBLE);
centCamera.setEnabled(false);
centCamera.setVisibility(View.GONE);
}
}, 500);
}
});