0

I need to completely disable the back button when taking a picture because my setup creates a file before the camera activity starts, therefore the user must go ahead with the picture. Adding finish(); right after startActivity(); takes me out (after removing all the activity stacks) so I removed it.

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) 
{
    // TODO Auto-generated method stub
    if ((keyCode == KeyEvent.KEYCODE_BACK)) 
    {
        return false;
    }
    return super.onKeyDown(keyCode, event);
}// end of disable back event

Using the above code, doesn't affect the camera activity so only works in the activity that calls the camera intent Is there a way to have the above method attached to the startActivityForResult(camera_intent, CAM_REQUEST); activity?

Thanks!

Amit Vaghela
  • 22,772
  • 22
  • 86
  • 142
Jube
  • 184
  • 2
  • 15

1 Answers1

0

Ok so for anyone else that needs to disable back button in camera mode and force the user to take the photo and save it.

(I needed to do just that because i had already created a file before the camera activity began and named it accordingly, however my case was all temporary so i just added the following)

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        //setups
        if(resultCode == RESULT_CANCELED){}
        else {

//THE REST OF WHATEVER YOU DO WITH THE PICTURE HERE

}  
}
Jube
  • 184
  • 2
  • 15