I am trying to get an images dimensions on an android.
I've created a simple test script below.
On an android (HTC Desire) clicking butt_1 'toBlob.size()' will return the correct dimensions when using Ti:2.1.5.
However when switching to Ti:3.0.2GA or Ti:3.0.3 you will get an error. However if you then click again you will get the correct size.
I've tried calling toBlob twice before trying to access width but this doesn't work either, does anyone know a work around?
var self = Ti.UI.createWindow({ title: 'Test', backgroundColor: 'yellow', }); var view = Ti.UI.createView({ top: 0, left: 0, height: Ti.UI.SIZE, width: Ti.UI.SIZE, layout: 'vertical', }); self.add(view); var image = Ti.UI.createImageView({ height: Ti.UI.SIZE, width: Ti.UI.SIZE, image: 'spinner_1.png', }); // Do not display the image on screen we just want the size // view.add(image); var butt_1 = Ti.UI.createButton({ top: '10dp', height: Ti.UI.SIZE, width: Ti.UI.SIZE, title: 'toBlob.size', }); butt_1.addEventListener('click',function() { var blob = image.toBlob(); Ti.API.info(blob); Ti.API.info(blob.width); Ti.API.info(blob.height); }); view.add(butt_1); var butt_2 = Ti.UI.createButton({ top: '10dp', height: Ti.UI.SIZE, width: Ti.UI.SIZE, title: 'toImage.size', }); butt_2.addEventListener('click',function() { var blob = image.toImage(); Ti.API.info(blob); Ti.API.info(blob.width); Ti.API.info(blob.height); }); view.add(butt_2); self.open();