tabGroup.open() causes Android Emulator to die??? What am I doing wrong guys??!

You must Login before you can answer or comment on any questions.

Is there some problem with tabGroups and the Android Emulator?? The following code:

// open tab group
tabGroup.open();
Causes the Android Emulator to die:
The application ... has stopped unexpectedly. Please try again.
Any suggestions appreciated...

— asked 10 months ago by Donal Lynch
3 Comments
  • tabGroup is created in the usual way:

    // create tab group
        var tabGroup = Titanium.UI.createTabGroup();
        var win1 = Titanium.UI.createWindow({  
            title:'window1',
            url:'window1.js'
        });
        var tab1 = Titanium.UI.createTab({  
            icon:'../images/a.png',
            title:'Window One',
            window:win1
        });
        tabGroup.addTab(tab1);  
        tabGroup.open();

    — commented 10 months ago by Donal Lynch

  • No code beyond this point is executed as the emulator immediately crashes.

    — commented 10 months ago by Donal Lynch

  • For android, a snippet of the DDMS log is a must in order to see what it going on behind the scenes.

    — commented 10 months ago by Stephen Feather

2 Answers

Hi Donal,

Try to set your tab Icon path properly and clean build and uninstall from emulator and run again. If you are in app.js file then your image path would be like this

icon:'/images/a.png',
sometime because of wrong path application crash in android.

— answered 10 months ago by Nitin Chavda
answer permalink
4 Comments
  • Hi Nitin, the image path is definitely correct, as I have double checked it and I am not in app.js... Is there anything else that you can think of??!

    — commented 10 months ago by Donal Lynch

  • Ok Can you tell us about your flow of application.

    — commented 10 months ago by Nitin Chavda

  • Hi! I wrote an answer, instead of a comment;) sorry for that..

    — commented 10 months ago by Donal Lynch

  • Show 1 more comment

My app.js says:

var loginWin = Titanium.UI.createWindow({  
    url:'controllers/login.js'
});
loginWin.open();
controllers/login.js:
Ti.include("../views/login.js");
Ti.include("../models/procedures.js");
var win = Ti.UI.currentWindow;
var scrollView;
 
var mainMenu = function(){
    var tabGroup = Titanium.UI.createTabGroup();
    var win1 = Titanium.UI.createWindow({  
        title:'window1',
        url:'window1.js'
    });
    var tab1 = Titanium.UI.createTab({  
        icon:'../images/a.png',
        title:'Window One',
        window:win1
    });
    tabGroup.addTab(tab1);  
    tabGroup.open();
});
 
var preloadData = function(){
    var procModel = new Procedure();
    procModel.loadInsurance( mainMenu );
};
 
scrollView = v_login.loginScreen( preloadData );
win.add( scrollView );
models/procedures.js:
function Procedure (){
    BaseDBModel.apply(this, arguments);
    this.loadInsurance = function(callback){
        Ajax.GET('insurance/getInsurance',
            function(data){
                Ti.App.Properties.setList('insurers', data);
                callback();
            }
        );
    };
 
};
 
Procedure.prototype = BaseDBModel;

— answered 10 months ago by Donal Lynch
answer permalink
1 Comment
  • Here is some code, to illustrate the flow. Works fine on iPhone, however I was not the original creator, so I am not 100% with it.. All I need is to get the tabGroup open, which is effectively the home screen. Thanks for your help so far!!

    — commented 10 months ago by Donal Lynch

Your Answer

Think you can help? Login to answer this question!