Bug 13777 - Mobile application "SoMA" throws exception and irregular behavior on changing device orientation
Summary: Mobile application "SoMA" throws exception and irregular behavior on changing...
Alias: None
Product: Android
Classification: Xamarin
Component: Samples ()
Version: 4.8.x
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Ben O'Halloran
Depends on:
Reported: 2013-08-06 09:13 UTC by Mohit Kheterpal
Modified: 2014-06-27 12:30 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Mohit Kheterpal 2013-08-06 09:13:26 UTC
Mobile application "SoMA" throws exception and irregular behavior on changing device orientation 

Case I -> When Default Setting are selected and application deploy on device
On Device S4 (4.2.2) ->
1) Click on "New Share" button
2) Take a Picture
3) Click on "Save" button
4) It asks user to share on social sites

Observed that : Saved picture is not displayed on device to share.
Screencast : http://www.screencast.com/t/Wu6TJCJjVy

5) Rotate device to landscape mode

Observed that : In Landscape mode, first camera appears to take picture again and after taking picture once user taps "Save" button, it throws Exception.

Case II ->  Minimum android version is selected as 2.3 in project properties >> Android application and application deploy on device :

On Device S4 (4.2.2) and On Device S2 (2.3.3)->
Now saved picture is displayed on device but when user rotate device in landscape mode, Facebook link is truncated.
And if user click on social website link randomly then it throws same exception

Screencast : http://www.screencast.com/t/Wu6TJCJjVy

Expected Result :Saved picture should displayed on device, it should not through any exception and it should build and run successfully on device.
Supplement info :
Exception : https://gist.github.com/AkhileshKumar01/224c56ce44b4ccf8e208
Android Log : https://gist.github.com/AkhileshKumar01/fe30e10aea8ad4633a16
Logcat : https://gist.github.com/AkhileshKumar01/6d2805a32c0353169f13

Environment info :
All Windows and Mac
X.Android 4.8.02028
XS 4.1.9 (build 5)
Comment 1 Peter Collins 2013-08-16 17:20:43 UTC
I saw http://www.screencast.com/t/Wu6TJCJjVy very briefly after taking a photo before it loaded into the image view, however I never failed to load the picture entirely on a number of devices.

I was also able to reproduce the 'Java.Lang.OutOfMemoryError' after taking a picture in landscape mode, with a 2.3.3 tablet (htc flyer)

It also looks like the application context may be lost when rotating on JellyBean devices only? (I was unable to reproduce this on the htc flyer). If I rotate the device after taking a picture it returns to the camera on a Nexus 4.

I'm assigning this to Craig for the time being, as he was the one to commit the sample :)
Comment 2 Ben O'Halloran 2014-06-27 12:30:22 UTC
Fixed: https://github.com/xamarin/mobile-samples/commit/1a638c7ded174ee2005acd44335b5ddb7bfd8b43
The image was only ever being loaded when the camera activity returned to Photoscreen. 
To fix the problem with the app crashing from running out of memory, a single copy of the image is loaded and just reused in either orientation.
The horizontal loading issue happened because a much large image was being used because of how the layout was set up. To fix this, a scaled version of the image is always used.