Skip to content

Instantly share code, notes, and snippets.

@MotiurRahman
Last active December 30, 2015 18:29
Show Gist options
  • Save MotiurRahman/7867712 to your computer and use it in GitHub Desktop.
Save MotiurRahman/7867712 to your computer and use it in GitHub Desktop.
openPhotoGallery() + Android + Picasa photo = no eventData
/*Here is the code for getting data from Picasa RSS FEED .And i get the image from Picasa album without any error.
Testing Environment: Titanoum sdk:3.1.3
Android SDK:4.1, 4.2.2
Titanium CLi: 3.1.2
Steps to Reproduce:
1. create a simple project
2.paste this code in app.js file
3.And run this with test environment
*/
var win = Ti.UI.createWindow({
backgroundColor : '#000',
layout : 'vertical',
navBarHidden : false,
title : 'Show Photo From Fhoto Galary'
});
var frmgalary = Ti.UI.createButton({
title : 'go_to_Picasa_gallery',
color : '#000',
width : Ti.UI.SIZE,
height : 60,
top : 10,
});
win.add(frmgalary);
//win.add(anImageView);
frmgalary.addEventListener('click', function() {
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,
height : 'auto',
});
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 : Ti.UI.SIZE,
height : Ti.UI.SIZE,
left:5
});
row.add(anImageView);
tabledata.push(row);
}
var tableView = Ti.UI.createTableView({
backgroundColor : 'white',
data : tabledata,
top : 10,
height:Ti.UI.SIZE
});
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 /* in milliseconds */
});
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