AndroidBase
AndroidBase

Reputation: 41

Back button to relaunch Camera Activity

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() {

        }

Upvotes: 1

Views: 403

Answers (1)

Guillaume Brunerie
Guillaume Brunerie

Reputation: 5371

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.

Upvotes: 3

Related Questions