I'm having some trouble with TableView navigation on the Android version of my app. The same code works perfectly fine on the iPhone but when I try to run it on the Android, nothing actually happens when I click on a row.
What can I do to fix this?
Here is the eventlistener code:
professionsTable.addEventListener('click', function(e) { alert(JSON.stringify(e.row)); if (e.row.path) { var win = Ti.UI.createWindow({ url: e.row.path, title: e.row.title }); var profession = e.row.title; win.profession = profession; //On Android, tabs don't maintain their own stack of windows if (Ti.Platform.osname === 'android') { win.open(); } else { Ti.UI.currentTab.open(win); } } });And the row creation code:
tableviewArray.push( {title: foo, class: "profession", hasChild: true, path: 'profession_details.js'} );Any help would be appreciated! Thanks!
1 Answer
Accepted Answer
Two problems:
- if you're using TabGroup, you should always open the new window via the active tab (it's not just an iOS thing, it's an android thing)
Ti.UI.currentTabdoesn't work
I think you're probably stumbling across old documentation that can be very misleading. You must always use the active tab, and it's up to you to keep track of the TabGroup in a variable somewhere.
See a previous post of mine and see if that helps out.
Your Answer
Think you can help? Login to answer this question!