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

  • SEARCH
  • Home
  • 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 7821705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:43:39+00:00 2026-06-02T07:43:39+00:00

API 15. When I stop my camera after taking a picture and go to

  • 0

API 15. When I stop my camera after taking a picture and go to the home screen and reopen my app and try to take another picture, my app crashes and I get this error:

04-20 12:04:38.437: E/AndroidRuntime(5150): FATAL EXCEPTION: Timer-2
04-20 12:04:38.437: E/AndroidRuntime(5150): java.lang.RuntimeException: Method called after release()
04-20 12:04:38.437: E/AndroidRuntime(5150):     at android.hardware.Camera.native_takePicture(Native Method)
04-20 12:04:38.437: E/AndroidRuntime(5150):     at android.hardware.Camera.takePicture(Camera.java:947)
04-20 12:04:38.437: E/AndroidRuntime(5150):     at android.hardware.Camera.takePicture(Camera.java:892)
04-20 12:04:38.437: E/AndroidRuntime(5150):     at com.prism.app.PrismActivity$5.run(PrismActivity.java:167)
04-20 12:04:38.437: E/AndroidRuntime(5150):     at java.util.Timer$TimerImpl.run(Timer.java:284)


public void surfaceCreated(SurfaceHolder holder) {
    // The Surface has been created, now tell the camera where to draw the preview.
    if (mCamera == null) {
        try {
            mCamera = Camera.open();
            mCamera.setPreviewDisplay(holder);
            mCamera.setDisplayOrientation(90);
            mCamera.startPreview();
        } catch (IOException e) {
            // error setting preview of camera
        }
    } else {
    }
}

public void surfaceDestroyed(SurfaceHolder holder) {
    // empty. Take care of releasing the Camera preview in your activity.
    if (mCamera != null) {
        mCamera.setPreviewCallback(null);
        mCamera.stopPreview();
        mCamera.release(); //need to take care of case when app is not closed completely still need to release
        mCamera = null;
    }
}
  • 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-02T07:43:40+00:00Added an answer on June 2, 2026 at 7:43 am

    From the stack trace, it looks like you have some TimerTask that is still scheduled to execute which uses the camera. It triggers after you close the camera, thus the error. You need cancel() the Timer, and also be prepared for the fact that the last TimerTask may be in progress from before you cancel. So the task needs to check whether the camera is closed before it operates on it.

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

Sidebar

Related Questions

When I try to play the sound file Windows Critical Stop.wav I get the
I am using the Windows API to take a picture with the attached webcam.
I saw in another question regarding swing Timer API and your methods, preference stop();
It looks like the YouTube API does not have a way to stop a
I have a mini API that is only for an app I have built.
I've read the API documentation on .stop()... http://api.jquery.com/stop/ But I'm still confused as to
­I'm coding with API 8. I need to get coordinates X and Y from
Looking at the web GeoLocation API documentation there are two ways to get location
Part of my script contacts Twitters api to get the number of shares: twitter
Most APIs ask developers to get an API key. The API key is then

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.