Robin Michael Poothurai
Robin Michael Poothurai

Reputation: 5664

Titanium : Android Ti.UI.currentWindow is not working for Tab Group

Am using Tab group and using 4 tabs, 4 different windows are added to the tabs. when i try to get current window , by Ti.UI.currentWindow in any of the views which is added to windows, am getting blank value, that is it is not returning, current window value.

Can anyone correct me??

Upvotes: 1

Views: 1341

Answers (1)

MRT
MRT

Reputation: 1610

you set "url" property in Window on creation time. Like

in "app.js"

var tabGroup        = Titanium.UI.createTabGroup();

var win_home        = Titanium.UI.createWindow({
    url     :'home.js',
        backgroundColor :'#000',
    backgroundImage :'image/bg_img1.png',
    barColor        : "#000000",//"#ff429c"

});

var tab_home = Titanium.UI.createTab({  
    index           : 0,
    window:win_home
});

tabGroup.addTab(tab_home);
tabGroup.open();

in "home.js"

var cur = Ti.UI.currentWindow;

var view = Ti.UI.createView({
    height : 100,
    width  : 100,
backgroundColor : "#0f0",
});

cur.add(view);

Understand this code and try to make like this. this is truly working... cheers...

Upvotes: 4

Related Questions