Photo Gallery Integration in Titanium

var win = Titanium.UI.createWindow();

var imageList = ['http://2niteshanghai.com/files/parties/thumbs/thumb_19_159_19_22_IMG_9699.JPG', 'http://2niteshanghai.com/files/parties/thumbs/thumb_19_819_19_52_IMG_9642.JPG', 'http://2niteshanghai.com/files/parties/thumbs/thumb_19_677_19_227_IMG_9598.JPG', 'http://2niteshanghai.com/files/parties/thumbs/thumb_19_184_19_602_IMG_9582.JPG', 'http://2niteshanghai.com/files/parties/thumbs/thumb_19_258_19_60_IMG_9640.JPG', 'http://2niteshanghai.com/files/parties/thumbs/thumb_19_269_19_226_IMG_9770.JPG'];
var scrollGalleryView = Ti.UI.createScrollableView({
    showPagingControl : true,
    maxZoomScale : 5,
    minZoomScale : 1
});
var viewCollection = [];
for (var i = 0; i < imageList.length; i++) {
    var view = Ti.UI.createView({});
    var img = Ti.UI.createImageView({
        maxZoomScale : 5,
        defaultImage : 'http://2niteshanghai.com/files/parties/thumbs/thumb_19_159_19_22_IMG_9699.JPG'
    });
    if (i < 3) {// only preload the first 3 images
        img.image = imageList[i];
    }
    view.add(img);
    viewCollection.push(view);
}
scrollGalleryView.addEventListener('scroll', function(e) {
    if (scrollGalleryView.currentPage < (imageList.length - 1)) {
        var nxt = scrollGalleryView.currentPage + 2;
        // get the 2nd next image (since the next one is already loaded)
        scrollGalleryView.views[nxt].children[0].image = imageList[nxt];
    }
});
scrollGalleryView.views = viewCollection;
win.add(scrollGalleryView);
win.open();
 

 

 

 

Output Screenshot :