Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8339291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:50:48+00:00 2026-06-09T04:50:48+00:00

I seem to be missing something as I fail to understand why in Android

  • 0

I seem to be missing something as I fail to understand why in Android documentation (Android Camera doc. link) it is recommended to release Camera object (as well as MediaRecorder) in onPause() Activity callback? Activity still might be visible by that time and Camera might be running preview so why the Camera object would be released in onPause() rather then onStop() when activity is already hidden? I understand that MediaRecorder object could be stopped in onPause() but Camera itself doesn’t make sense to me. What am I missing here? Piece of code from Android documentation is below (its under Releasing the Camera heading):

    @Override
protected void onPause() {
    super.onPause();
    releaseMediaRecorder();       // if you are using MediaRecorder, release it first
    releaseCamera();              // release the camera immediately on pause event
}

private void releaseMediaRecorder(){
    if (mMediaRecorder != null) {
        mMediaRecorder.reset();   // clear recorder configuration
        mMediaRecorder.release(); // release the recorder object
        mMediaRecorder = null;
        mCamera.lock();           // lock camera for later use
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T04:50:49+00:00Added an answer on June 9, 2026 at 4:50 am

    according to application lifecycle

    Paused
        Another activity is in the foreground and has focus, but this one is 
                still visible. That is, another activity is visible on top of this 
                one and that activity is partially transparent or doesn't cover the 
                entire screen. (...)
    

    I think the documentation follows the rule of the thumb “release resources as soon as possible”: onPause is earlier than onStop.

    camera in the background window needs energy while the user has to to pay attentions to the popup.

    Camera in the backgroud is of course more comfortable but for a mobile battery life time is more important.

    The popup that intercepted you activity might need the camera and/or might need a lot of memory.

    In your scenario when the camera should continue recording in the background the camera-s lifecycle and recording should be controlled by a service

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I seem to be missing something obvious here, why would I want more than
Ok I feel really dumb asking this but I seem to be missing something
Maybe I'm just missing something in the docs, but it seem it's not possible
I seem to be missing something obvious here, but cannot see what it is.
I'm playing around with the SPL autoload functionality and seem to be missing something
New to Cocoa, and seem to be missing something. What is the most elegant/idiomatic
I guess this is easy, I seem to be missing something simple. I need
I'm really new to SVN and seem to be missing something here... I have
Maybe I am missing something, but they seem similar. If you use for example...
I must be missing something here, but I seem to be having some trouble

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.