Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (android)
Viewing all articles
Browse latest Browse all 7655

Sometime the image is displayed and sometime is not!

$
0
0

Ti SDK: 3.2.2GA

Platform target: Android

Device: emulator and S3

Hi, I'm trying to crop an image with this code:

function cropImage (img){
    var _up;
    var _cropUp; 
    var up;
 
    _up = Ti.UI.createImageView({
        image: img.image,
        width: img.width,
        height: img.height,
    });
 
    _cropUp = Ti.UI.createView({
        width: img.width,
        height: parseInt(img.height/2),
    });
    _cropUp.add(img);
    img.left = 0;
    img.top = 0;
 
    up = Ti.UI.createImageView({        
        image: _cropUp.toImage(),
        width: img.width,
        height: _cropUp.height,     
    });
 
    return up;
 
};
var win = Ti.UI.createWindow({
    backgroundColor: '#abd',    
});
 
var img01 = Ti.UI.createImageView({image: '12.jpg', width: 500, height: 500,});
 
win.add(cropImage(img01));
 
win.open();
The strange is that sometime the image is showed and sometime not. In this case i have to exit from app and relaunch it to see it. What kind of mysterious issue is this? Thanks for attention.

Viewing all articles
Browse latest Browse all 7655

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>