hi i have added 3 tabs to sampleRSSfeed App and inside every tab i have called MasterView and put object of it inside every tab and i had take the activity from wondow and put it inside the view which call RefreshRss Function . but there is no rss feed appeared . i have added the code of my Application Window which are called in app.js . i use Microsoft Windows 7 and i develop that App For Android .
//Application Window Component Constructor function ApplicationWindow() { var rsspolitics = require('services/rsspolitics'), PMasterView = require('ui/common/MasterView'), PDetailView = require('ui/common/DetailView'); var rsssports = require('services/rsssports'), SMasterView = require('ui/common/MasterView'), SDetailView = require('ui/common/DetailView'); var rsscommerce = require('services/rsscommerce'), CMasterView = require('ui/common/MasterView'), CDetailView = require('ui/common/DetailView'); //create object instance var mainwindow = Ti.UI.createWindow({ title:'self', backgroundColor:'#fff', exitOnClose:true, navBarHidden:false, }); // create Tabs var tabGroup = Titanium.UI.createTabGroup(); var politicsTab = Titanium.UI.createTab({ icon:'images/11-clock.png', title:'Politics', window:mainwindow, }); var sportsTab = Titanium.UI.createTab({ title:'Sports', icon:'images/15-tags.png', window:mainwindow, }); var commerceTab = Titanium.UI.createTab({ title:'Commerce', icon:'images/15-tags.png', window:mainwindow, }); tabGroup.addTab(sportsTab); tabGroup.addTab(commerceTab); tabGroup.addTab(politicsTab); tabGroup.open(); ///////////////////////////////// i Guess error are there because politicsrefreshRSS(); in activity doesn't work in the view like it should be while it work fin if i add it to window.addeventlistner() ./////////////////////////////////// var politicsView = new PMasterView(); var actInd = Ti.UI.createActivityIndicator({ message: 'Loading...', color: '#fff', activity: { onCreateOptionsMenu: function(e) { var menu = e.menu; var menuItem = menu.add({ title: "Refresh" }); menuItem.setIcon("images/refresh_icon.png"); menuItem.addEventListener("click", function(e) { politicsrefreshRSS(); }); } } }); var commerceView = new CMasterView(); var actInd = Ti.UI.createActivityIndicator({ message: 'Loading...', color: '#fff', activity: { onCreateOptionsMenu: function(e) { var menu = e.menu; var menuItem = menu.add({ title: "Refresh" }); menuItem.setIcon("images/refresh_icon.png"); menuItem.addEventListener("click", function(e) { commercerefreshRSS(); }); } } }); var sportsView = new SMasterView(); var actInd = Ti.UI.createActivityIndicator({ message: 'Loading...', color: '#fff', activity: { onCreateOptionsMenu: function(e) { var menu = e.menu; var menuItem = menu.add({ title: "Refresh" }); menuItem.setIcon("images/refresh_icon.png"); menuItem.addEventListener("click", function(e) { sportsrefreshRSS(); }); } } }); politicsTab.add(politicsView); commerceTab.add(sportsView); politicsTab.add(commerceView); //add behavior for master view politicsView.addEventListener('itemSelected', function(e) { // Create a detail view window var detailView = new DetailView(); var detailContainerWindow = Ti.UI.createWindow({ title: 'View Article', navBarHidden: false, backgroundColor:'#fff' }); detailContainerWindow.add(detailView); // Show an activity dialog in the status bar while the article loads var pb; detailContainerWindow.addEventListener('open', function() { pb = Titanium.UI.createActivityIndicator({ location: Ti.UI.ActivityIndicator.STATUS_BAR, type: Ti.UI.ActivityIndicator.DETERMINANT, message:'Loading article...', }); pb.show(); }); detailView.addEventListener('articleLoaded', function() { pb.hide(); }); detailView.showArticle(e.link); detailContainerWindow.open(); }); sportsView.addEventListener('itemSelected', function(e) { // Create a detail view window var detailView = new DetailView(); var detailContainerWindow = Ti.UI.createWindow({ title: 'View Article', navBarHidden: false, backgroundColor:'#fff' }); detailContainerWindow.add(detailView); // Show an activity dialog in the status bar while the article loads var pb; detailContainerWindow.addEventListener('open', function() { pb = Titanium.UI.createActivityIndicator({ location: Ti.UI.ActivityIndicator.STATUS_BAR, type: Ti.UI.ActivityIndicator.DETERMINANT, message:'Loading article...', }); pb.show(); }); detailView.addEventListener('articleLoaded', function() { pb.hide(); }); detailView.showArticle(e.link); detailContainerWindow.open(); }); commerceView.addEventListener('itemSelected', function(e) { // Create a detail view window var detailView = new DetailView(); var detailContainerWindow = Ti.UI.createWindow({ title: 'View Article', navBarHidden: false, backgroundColor:'#fff' }); detailContainerWindow.add(detailView); // Show an activity dialog in the status bar while the article loads var pb; detailContainerWindow.addEventListener('open', function() { pb = Titanium.UI.createActivityIndicator({ location: Ti.UI.ActivityIndicator.STATUS_BAR, type: Ti.UI.ActivityIndicator.DETERMINANT, message:'Loading article...', }); pb.show(); }); detailView.addEventListener('articleLoaded', function() { pb.hide(); }); detailView.showArticle(e.link); detailContainerWindow.open(); }); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function politicsrefreshRSS() { alert(11); rsspolitics.loadRssFeed({ start: function() { actInd.show(); }, error: function() { actInd.hide(); }, success: function(data) { politicsView.refreshRssTable(data); actInd.hide(); } }); } function sportsrefreshRSS() { rsssports.loadRssFeed({ start: function() { actInd.show(); }, error: function() { actInd.hide(); }, success: function(data) { sportsView.refreshRssTable(data); actInd.hide(); } }); } function commercerefreshRSS() { rsscommerce.loadRssFeed({ start: function() { actInd.show(); }, error: function() { actInd.hide(); }, success: function(data) { commerceView.refreshRssTable(data); actInd.hide(); } }); } // refresh RSS when ApplicationWindow opens tabGroup.addEventListener('focus', function(e) { setTimeout(function() { Ti.API.debug('tab changed to ' + tabGroup.activeTab); },100); }); return mainwindow; }; module.exports = ApplicationWindow;