Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

'Titanium.UI.currentWindow' [null] is not an object. at app.js?

This is what I got in the app.js and I got the bloody red screen with message "Result of expression 'Titanium.UI.currentWindow' [null] is not an object. at app.js ."

What do you think is wrong?

var table_data = [
{title:'item1', test:'sample.js'},
{title:'item2', test:'sample.js'},
{title:'item3', test:'sample.js'}
];

var tableview = Titanium.UI.createTableView({
data:table_data
});

Titanium.UI.currentWindow.add(tableview); //this is the line where the error is!

— asked October 8th 2010 by Haluk Karamete
0 Comments

5 Answers

  • I just started Titanium today, but I think their is no active window yet. You made a view, but no window so the currentWindow method returns null

    — answered October 8th 2010 by Ronnie Swietek
    permalink
    0 Comments
  • Let me answer this question myself..

    There is no concept of currentWindow when you are on the app.js

    the above snippet would have run fine if it were to be in a seperate js file which is accessed thru a createwindow method

    — answered October 8th 2010 by Haluk Karamete
    permalink
    1 Comment
    • Total agree. You can use Ti.UI.currentTab or Ti.UI.currentWindow in anywhere but not in app.js

      — commented October 9th 2010 by Triet BuiMinh
  • So how do we add things to the main app.js?

    I've always done by creating a Tab Group. How would we go about just adding buttons on the main page that would link to other pages with Tab groups?

    — answered April 20th 2011 by Deric Davis
    permalink
    0 Comments
  • eek I got a 404 and it told me to reload!

    — answered October 8th 2010 by Ronnie Swietek
    permalink
    0 Comments
  • I just started Titanium today, but I think their is no active window yet. You made a view, but no window so the currentWindow method returns null

    — answered October 8th 2010 by Ronnie Swietek
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.