Skip to content

Instantly share code, notes, and snippets.

@csemrm
Created December 15, 2013 13:46
Show Gist options
  • Save csemrm/7973259 to your computer and use it in GitHub Desktop.
Save csemrm/7973259 to your computer and use it in GitHub Desktop.
Image display form Picasa photo in Titanium
var win = Ti.UI.createWindow({
backgroundColor : '#fff',
layout : 'vertical',
navBarHidden : false,
title : 'Show Photo From Fhoto Galary'
});
var url = "https://picasaweb.google.com/data/feed/base/user/115403892804643478218?alt=rss&kind=album&hl=en_US&imgmax=1600";
var xhr = Ti.Network.createHTTPClient({
onload : function() {
var xml = this.responseXML;
var channel = xml.documentElement.getElementsByTagName("channel");
var tabledata = [];
var items = xml.documentElement.getElementsByTagName("item");
for (var i = 0; i < items.length; i++) {
var thumbnails = items.item(i).getElementsByTagName("media:thumbnail");
var row = Ti.UI.createTableViewRow({
className : 'forumEvent',
selectedBackgroundColor : 'white',
rowIndex : i,
});
Ti.API.info('thumbnails.item(0).getAttribute("url") ' + thumbnails.item(0).getAttribute("url"));
// Create an ImageView.
var anImageView = Ti.UI.createImageView({
image : thumbnails.item(0).getAttribute("url"),
width : 80,
height : 80,
});
row.add(anImageView);
tabledata.push(row);
}
var tableView = Ti.UI.createTableView({
backgroundColor : 'white',
data : tabledata,
top : 40
});
win.add(tableView);
},
onerror : function(e) {
// this function is called when an error occurs, including a timeout
Ti.API.debug(e.error);
alert('error');
},
timeout : 5000
});
xhr.open("GET", url);
xhr.send();
win.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment