Hi All
I am looking for a way to reload a page upon a tab click currently it just maintains the previous state i want it to completely close and reopen again.
I am a newbie at titanium so some help with this would be amazing.
// this sets the background color of the master UIView (when there are no windows/tab groups on it) Titanium.UI.setBackgroundColor('#fff'); var tabGroup = Titanium.UI.createTabGroup(); var musicPlayer = Titanium.UI.createWindow({ title:'Music Player', url:'main_windows/player.js' }); var MusicPlayerTab = Titanium.UI.createTab({ title:"Music Player", window:musicPlayer }); var musicSync = Titanium.UI.createWindow({ title:'Sync', url:'main_windows/sync.js' }); var musicSyncTab = Titanium.UI.createTab({ title:'Sync', window:musicSync }); tabGroup.addTab(MusicPlayerTab); tabGroup.addTab(musicSyncTab); tabGroup.open();and player.js i have been trying to do the following but it doesnt work.
var win = Titanium.UI.currentWindow; Ti.UI.currentTab.close(win); Ti.UI.currentWindow.addEventListener('open', function(e) { //code runs here??? });so i am looking for every time the MusicPlayerTab is open it re runs the code from scratch instead off maintaining previous state.
1 Answer
Accepted Answer
try using the focus event or blur event
Ti.UI.currentWindow.addEventListener('focus', function(e) { //code runs here??? });or
Ti.UI.currentWindow.addEventListener('blur', function(e) { //code runs here??? });
Your Answer
Think you can help? Login to answer this question!