I have a camera activity. I want to make it looks like the default android camera when the user press the back button after taking a picture, the preview is gone and the camera is back again. He can repeat this as many times as he likes. Of course, if the user did not take any pictures, pressing the back button will bring him back to the previous view. How can I achieve that? Thanks.
@Override
public void onBackPressed() {
}
You don’t have to do anything.
If you are starting a new Activity with
startActivity()when the preview is displayed, Android will make the back button behave correctly.Edit:
You should read the dev guide, in particular this page.