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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:12:55+00:00 2026-06-05T04:12:55+00:00

This issue is only occurring on two older Samsung Galaxy models, but is nevertheless

  • 0

This issue is only occurring on two older Samsung Galaxy models, but is nevertheless very reproducable.

I have a simple app that displays a photo that is taken through the device’s camera app. It has one button to start that app, and processes the result in an AsyncTask to downsample it into an ImageView.

The trouble arises from the flow of the activity when returning from the camera app: for some reason, the activity is created, processes result in an AsyncTask in the onActivityResult(), is destroyed, only to immediately be recreated. Once the AsyncTask completes, it hold a reference to the incorrect/old activity.

Placing some debug statements into the various lifecycle callbacks reveals this odd behavior:

06-02 16:01:53.509: I/myapp(4437): onCreate com.myapp.PhotoActivity_@488cbef8
06-02 16:01:53.509: I/myapp(4437): onResume com.myapp.PhotoActivity_@488cbef8
06-02 16:01:58.298: I/myapp(4437): onPause com.myapp.PhotoActivity_@488cbef8
06-02 16:01:59.470: I/myapp(4437): onStop com.myapp.PhotoActivity_@488cbef8
[a photo is taken in the camera app]
06-02 16:02:10.196: I/myapp(4437): onCreate com.myapp.PhotoActivity_@4874f8b8
06-02 16:02:10.251: I/myapp(4437): onActivityResult com.myapp.PhotoActivity_@4874f8b8
06-02 16:02:10.259: I/myapp(4437): onResume com.myapp.PhotoActivity_@4874f8b8
06-02 16:02:10.712: I/myapp(4437): onPause com.myapp.PhotoActivity_@4874f8b8
06-02 16:02:10.720: I/myapp(4437): onStop com.myapp.PhotoActivity_@4874f8b8
06-02 16:02:10.923: I/myapp(4437): onCreate com.myapp.PhotoActivity_@48817118
06-02 16:02:10.931: I/myapp(4437): onResume com.myapp.PhotoActivity_@48817118
06-02 16:02:12.564: I/myapp(4437): onBitmapLoaded com.myapp.PhotoActivity_@4874f8b8

The instance of the activity on which onActivityResult() is called (note the hash codes above) no longer matches the final instance that is being displayed. When my bitmap loading through onBitmapLoaded() completes, it therefore also holds the incorrect instance.

Why is this happening, and how can I prevent the activity from being (needlessly) recreated?

  • 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-05T04:12:57+00:00Added an answer on June 5, 2026 at 4:12 am

    Apparently configuration of application changes! Add logs in onDestroy and improve log in onCreate to show what is the value of Bundle savedInstanceState. if savedInstanceState is not null then configuration change enforced recreation of Activity.
    Adding logs in onSaveInstanceState(Bundle) could help to.

    You can handle yourself configuration changes by setting Activity property android:configChanges in manifest.

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

Sidebar

Related Questions

Ok I have a strange issue again with Internet Explorer but this only happens
I have a very strange issue going on here. It's only occurring on Internet
This issue only exists under IIS5.1. I have found a way of resolving the
This problem only occurs in Internet Explorer 8 & 9 I have two dropdowns
I've been investigating this issue that only seems to get worse the more I
There are various posts on the web about this issue whereby the ComboBox only
This is somewhat complex issue with several questions. Feel free to answer only the
Note: This issue appears to be limited to SQL Server 2005 SP2 I have
I have never seen this before. I have a simple custom view that has
This issue only exists in Chrome, works fine in IE/FF... Example: http://www.8wayrun.com/media/algol-killer-combos.621/ On the

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.