Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-817] [Android] imageView.toImage() crashes app

GitHub Issuen/a
TypeBug
PriorityTrivial
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:54:20.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.6.0 M10
ComponentsAndroid
Labelsandroid, defect, imageview, release-1.6.0, toimage
ReporterMark Peace
AssigneeDon Thorp
Created2011-04-15T02:37:06.000+0000
Updated2011-04-17T01:54:20.000+0000

Description

As in the following code;

    Ti.Media.showCamera ({
        autoHide:true,
        allowImageEditing:false,
        saveToPhotoGallery:false,
        success:function(e) {
            var image = e.media;
            var imageView = Titanium.UI.createImageView({
                image:image,
                width:150,
                height:150
            });

            image = imageView.toImage();
        }
    });

Comments

  1. Brion Vibber 2011-04-15

    I found I could work around the crash by adding the imageView to a window to fully instantiate it before scaling. However, the resulting object isn't a TiBlob, but rather appears to be an event-like object similar to what we get directly from showCamera (eg, you need to pull the 'media' property from it to actually get the image).

  2. Dawson Toth 2011-04-15

    This has been fixed by https://appcelerator.lighthouseapp.com/projects/32238/tickets/1659-android-toimage-functions-blowing-up-with-ui-widgets"> #1659; first adding the imageview to the window to fully instantiate it shouldn't be necessary anymore.

    And yes, you are correct in that you need to pull the "media" property from it to get the actual image. I just recently created https://appcelerator.lighthouseapp.com/projects/32238-titanium-mobile/tickets/3268-android-viewtoimage-platform-inconsistency"> #3268 to deal with this inconsistency between the platforms.

  3. Don Thorp 2011-04-15

    Marking resolved due to fix with #1659

JSON Source