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

The Archive Base Latest Questions

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

My code works as expected on smaller and bigger devices (Motorola Xoom, Samsung Galaxy

  • 0

My code works as expected on smaller and bigger devices (Motorola Xoom, Samsung Galaxy Player 4.0, Kyocera Digno), but for the Samsung Galaxy Tab 7.0, after launching an ACTION_IMAGE_CAPTURE intent and taking a picture, when the app returns onDestroy() is called, followed by onCreate(), then onActivityResult() is called, and finally, onDestroy() and onCreate() are called again, which is of course undesireable – only onActivityResult() should be called.

Possibles clues:

  • The Galaxy Tab 7.0 has a screen size that is explicity not supported in the manifest file (and this is the only device I have tested with an unsupported screen size), so the user may choose scretch-to-fit or zoom-to-fit. Both UIs have the same (bad) behavior.
  • The camera activity seems to switch orientation when previewing a picture. My app only supports portrait mode (edit: on smaller screens – on non-xlarge screens, it supports orientation changes). Maybe the orientation change is destroying my activity, somehow.
  • I have tried launching and returning from a different intent (email intent), and my app is not destroyed and re-created in that case.

Let me know if more information or a code sample is needed.

Edit: the issue has been narrowed down to the orientation change. As per Karthik’s answer, setting android:configChanges="orientation" fixes the issue. The only problem is, my app supports orientation changes on xlarge screens. This setting breaks this functionality on those devices. I’ve tried using android:configChanges="@string/config_changes" and providing a different string depending on the screen size, but now I’m getting an “Installation error: INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION”. According to this, Android Activity, how to override manifest's android:configChanges with Java code?, there is no way to set it programmatically. Is my only option left to handle all orientation changes in my app manually?

  • 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-02T01:03:45+00:00Added an answer on June 2, 2026 at 1:03 am

    I discovered that the reason my app restarts is because the device runs out of memory when starting the camera app and the OS recycled my main Activity. That wouldn’t be a problem, except I had a Fragment-based layout and some Fragment initialization was being done in onCreate(), regardless of the savedInstanceState. This caused the automatic Fragment restoration to be discarded and made the app look like it was restarting from the beginning when in fact it was just trying to be restored.

    Ex:

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    
        // add main menu -- WRONG!
        MainMenuFragment mainMenu = new MainMenuFragment();
        FragmentTransaction ft = this.getSupportFragmentManager().beginTransaction();
        ft.add(R.id.contents, mainMenu);
        ft.commit();
    
        if (savedInstanceState != null) {
            // <restore state>
        }
        else {
            // <initialize stuff>
        }
    }
    

    To fix it, I skipped the Fragment initialization when savedInstanceState was not null and made sure that the state was being saved correctly in onSaveInstanceState() and restored in onCreate(), and implemented the normal handling for onActivityResult().

    Ex:

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    
        if (savedInstanceState != null) {
            // <restore state>
        }
        else {
            // <initialize stuff>
    
            // add main menu -- CORRECT!
            MainMenuFragment mainMenu = new MainMenuFragment();
            FragmentTransaction ft = this.getSupportFragmentManager().beginTransaction();
            ft.add(R.id.contents, mainMenu);
            ft.commit();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Following chunk html code works as expected: <iframe src=http://www.amazon.com/></iframe> But when trying embed inner
The following code works as expected on CentOS and Ubuntu O/s but not on
The following (absurd but illustrative) code works as expected by mutating the list defined
The following code works as expected in IE8 and Safari4, but not in Firefox3.6
The following code works as expected for me under 64-bits, but fails under 32-bit
Most of the code works as expected, but I'm getting some unusual behavior under
The following code works as expected: NSLog(@%@, [NSString stringWithString:@test]; // Logs test But when
The following code basically works as expected. However, to be paranoid, I was wondering,
The following F# code works as I expected, printing `Matched as 'A': let (|Char|_|)
This code didn't works as expected. I want to select all the posts that

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.