[TIMOB-817] [Android] imageView.toImage() crashes app
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Trivial |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:54:20.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.6.0 M10 |
Components | Android |
Labels | android, defect, imageview, release-1.6.0, toimage |
Reporter | Mark Peace |
Assignee | Don Thorp |
Created | 2011-04-15T02:37:06.000+0000 |
Updated | 2011-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();
}
});
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).
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.
Marking resolved due to fix with #1659