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

]]>

8 Commentsto 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…

  1. Anonymous says:

    < ![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

    ]]>

  2. Anonymous says:

    < ![CDATA[

    You need commas between the functions

    ]]>

  3. Anonymous says:

    < ![CDATA[

    thanks il give it a go ๐Ÿ™‚

    ]]>

  4. Anonymous says:

    < ![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));


    }



    }

    ]]>

  5. Anonymous says:

    < ![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

    ]]>

  6. Anonymous says:

    < ![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 ๐Ÿ‘

    ]]>

  7. Anonymous says:

    < ![CDATA[

    Nice script.

    ]]>

  8. Anonymous says:

    < ![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.

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *