Can anyone tell me what i did wrong here as you can see in the video im trying to add tabs to the actionbar and it…
Can anyone tell me what i did wrong here as you can see in the video im trying to add tabs to the actionbar and it works fine until i uncomment the other 2 interface functions.
Heres a link to the docs incase it helps and il post the listener code in the comments, cheers. https://developer.android.com/reference/android/app/ActionBar.TabListener.html
]]>
< ![CDATA[
var listener = new ActionBar.TabListener(){
onTabSelected: function(tab, ft){
Android.makeNewToast(“Tab ” + (tab.getPosition() +1) + ” selected”, false).show();
}
/*
onTabUnselected: function(tab, ft){
Android.makeNewToast(“Selected ” + (“tab ” + (tab.getPosition() +1) + ” unselected”, false).show();
}
onTabReselected: function(tab, ft){
}
*/
}; // end listener
]]>
< ![CDATA[
You need commas between the functions
]]>
< ![CDATA[
thanks il give it a go ๐
]]>
< ![CDATA[
bindClass(“http://android.view.MenuItem“);
bindClass(“http://android.app.ActionBar“);
function create(menu){
var item;
var settings = http://menu.add(“Settings”);
http://settings.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
var camera = http://menu.add(“Camera”);
http://camera.setIcon(http://Image.createTextIcon(“L”, 420, 0xffffffff, 0x00000000, null).toDrawable());
http://camera.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
return true;
}
function select(item){
alert(http://item.getTitle());
return true;
}
getEvent().getScreen().showActionBar(create, select);
var ab = getActiveScreen().getContext().getActionBar();
with(ab){
setTitle(“Lightning Launcher”);
setDisplayHomeAsUpEnabled(true);
setHomeAsUpIndicator(http://Image.createTextIcon(“F”, 420, 0xffffffff, 0x00000000, null).toDrawable());
http://ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
var listener = new http://ActionBar.TabListener(){
onTabSelected: function(tab, ft){
Android.makeNewToast(“Tab ” + tab.getPosition() + 1 + ” selected”, false).show();
},
onTabUnselected: function(tab, ft){
Android.makeNewToast(“Tab ” + tab.getPosition() + 1 + ” unselected”, false).show();
},
onTabReselected: function(tab, ft){
},
};
for(var i = 1; i < = 5; i++){
http://ab.addTab(http://ab.newTab().setText(“TAB ” + i).setTabListener(listener));
}
}
]]>
< ![CDATA[
I had to rewrite it because i lost the original but anyways ive tried adding the commas and that didnt work theres tje code^ if you wanna try it just set it to run from a shortcut/run script
]]>
< ![CDATA[
yup it was because of the commas i missed one out azwell so ive added it to the code above incase anyone wants it, cheers for the help ๐
]]>
< ![CDATA[
Nice script.
]]>
< ![CDATA[
Thanks ๐ its gunna be a part of my next setup which will be 100% Lightning made. The tabs are going to switch between desktops and the camera action button will be changed to open the script editor or a a specific playlist.
]]>