Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TIMOB-14918: Changing orientation with camera overlay causes app to crash #4583

Merged
merged 2 commits into from
Aug 21, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2012 by Appcelerator, Inc. All Rights Reserved.
* Copyright (c) 2012-2013 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
Expand Down Expand Up @@ -115,7 +115,6 @@ public void onCreate(Bundle savedInstanceState)

// set preview overlay
localOverlayProxy = overlayProxy;
overlayProxy = null; // clear the static object once we have a local reference

// set overall layout - will populate in onResume
previewLayout = new PreviewLayout(this);
Expand Down Expand Up @@ -284,6 +283,16 @@ private void stopPreview()
previewRunning = false;
}

@Override
public void finish()
{
// For API 10 and above, the whole activity gets destroyed during an orientation change. We only want to set
// overlayProxy to null when we call finish, i.e. when we hide the camera or take a picture. By doing this, the
// overlay proxy will be available during the recreation of the activity during an orientation change.
overlayProxy = null;
super.finish();
}

/**
* Computes the optimal preview size given the target display size and aspect ratio.
*
Expand Down