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 7680225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:03:59+00:00 2026-05-31T18:03:59+00:00

[EDIT: Problem solved. Please see my answer below.] In my app I call the

  • 0

[EDIT: Problem solved. Please see my answer below.]

In my app I call the system camera to take a picture, and then handle the result in onActivityResult. You know, the usual. It used to work, but now my calling activity gets killed while I’m taking the picture. Specifically, onDestroy() is called on my activity right after I press the camera shutter. The photo does get taken & saved (I’ve checked that the file gets written on the SD card). After I accept the photo, instead of returning to the calling activity and invoking onActivityResult, the previous activity in the activity stack gets called. I see no exceptions in the logcat. My custom exception handler doesn’t get called. If it matters, my app also includes a service that listens to GPS updates, but I unregister all the receivers in onPause().

Here’s the call stack for MyCallingActivity.onDestroy():

Thread [<1> main] (Suspended (breakpoint at line 303 in NewPlaceDetailsActivity))   
    NewPlaceDetailsActivity.onDestroy() line: 303   
    ActivityThread.performDestroyActivity(IBinder, boolean, int, boolean) line: 2663    
    ActivityThread.handleDestroyActivity(IBinder, boolean, int, boolean) line: 2694 
    ActivityThread.access$2100(ActivityThread, IBinder, boolean, int, boolean) line: 117    
    BinderProxy(ActivityThread$H).handleMessage(Message) line: 968  
    ActivityThread$H(Handler).dispatchMessage(Message) line: 99 
    Looper.loop() line: 130 
    ActivityThread.main(String[]) line: 3687    
    Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]  
    Method.invoke(Object, Object...) line: 507  
    ZygoteInit$MethodAndArgsCaller.run() line: 842  
    ZygoteInit.main(String[]) line: 600 
    NativeStart.main(String[]) line: not available [native method]  

This is how I start the camera activity, in case you’re wondering:

protected void startCamera() {
    createPhotoDirsIfNeeded();

    String fileName = "temp.jpg";  
    ContentValues values = new ContentValues();  
    values.put(MediaStore.Images.Media.TITLE, fileName);  
    m_capturedImageUri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);  

    m_photoFileName = APP_PHOTO_PATH + "/" + DateFormat.format(DATE_FORMAT, Calendar.getInstance().getTime()) + ".jpg";
    File picFile = new File(m_photoFileName);
    if(picFile.exists()) {
        picFile.delete();
    }

    // start the camera activity
    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    intent.putExtra(MediaStore.EXTRA_OUTPUT,  Uri.fromFile(picFile));
    startActivityForResult(intent, IntentHelper.REQUEST_TAKE_PHOTO);
}

How can I find out why does my activity get killed, AND removed from the stack instead of being created again?

  • 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-05-31T18:04:00+00:00Added an answer on May 31, 2026 at 6:04 pm

    OK, I found the problem. The issue was not so much that the activity was being killed, but that it was not being restored. I realized that this can happen when your activity is declared in the manifest with android:noHistory="true". So the activity was removed from the stack upon being killed, and the previous activity was shown instead.

    After I removed the noHistory parameter, the activity started appearing again after using the camera.

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

Sidebar

Related Questions

EDIT: This problem has been solved. See below. Hey all. I'm building an iPhone
Edit: I solved my problem but if you have anything to add please do.
edit: I was trying to solve a spoj problem. Here is the link to
[Edit: This problem applies only to 32-bit systems. If your computer, your OS and
Edit 1: Uninstalled & Reinstalled Edit 2: Same problem. Seriously? Yes. I am having
Most of you probably know the following problem: You edit an HTML, view the
Edit: I fixed the problem by just starting from scratch. Sorry to waste y'alls
Edit : The bug that caused this problem has been fixed. The @version tag
EDIT: I have realized the source of my problem. I only have count information
My problem: I have Ido-mode enabled and I want to edit (for example) a

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.