Search code examples
javascripttitaniumappcelerator

Appcelerator-Titanium project wont run on Android


ok, so I'm studying on the use of Appcelerator-Titanium and am going over the tutorials. from what i learned i tried to run this code. it runs perfectly fine on the iOS simulator but it wont run on Android emulator or an Android phone (Samsung Galaxy 2s). this is the code I've tried to run.

<!-- language: lang-js -->
    (function(){
        //creating a UI element for the application to run on
        app.UI = {};


        app.UI.createAppWindow = function(_args){
        //create the tab group to return from function
        var tGroup = Ti.UI.createTabGroup();
        //
        //creating the first window for the UI
        //
        var fWindow = Ti.UI.createWindow({
            title:'main window NUMBER 1',
            backgroundColor:'#fff'
        }) ;

        var tab1 = Ti.UI.createTab({
            icon:'KS_nav_ui.png',
            title:'main tab NUMBER 1',
            window:fWindow
        });

        var lbl1 = Ti.UI.createLabel({
            text:'this is my label this is my fun',
            color:'#999',
            font:{fontSize:20},
            textAlign:'center',
            width:'auto'
        });

        tab1.add(lbl1);

        tGroup.add(tab1);
        tGroup.open();
        }
    })();

Solution

  • well, the problem was in the line: tGroup.add(tab1); it's supposed to be: tGroup.addTab(tab1);