Titanium Community Questions & Answer Archive

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

Closing application on Android

I have an app that works fine on the iPhone, but using Android's default tabgroup and navbar was just too ugly!

So I dumped the tabgroup in favour of a couple of extra buttons on the homescreen and open every window fullscreen, navbar hidden and then create my own navbar image.

The problem is using the back button to go back through the windows does not exit the app from the homescreen, it brings up a blank page.

Does anyone know how to reference this page and close it?

Many thanks

Des

From app.js :-


var win1 = Titanium.UI.createWindow({  
    url:'home.js',
    fullscreen:true,
    navBarHidden:true,
    backgroundColor:'#fff'
});
— asked July 4th 2010 by Derrick Huth
  • android
  • mobile
  • window
0 Comments

2 Answers

  • Accepted Answer

    Set the property 'exitOnClose' to true for the window you want to be the last in the stack and it'll close the app when the user hits the back button when that window is active.

    — answered July 4th 2010 by David Ashwood
    permalink
    0 Comments
  • Many thanks for the quick reply, it worked perfectly.

    I am begining to regain faith in Titanium for Android ;-)

    — answered July 4th 2010 by Derrick Huth
    permalink
    1 Comment
    • I also noticed that if you don't set the fullscreen property on your first window (at all) you will achieve this effect. Anyone know why? If i set fullscreen to false I see the blank screen as well.

      This exits correctly:

      var win1 =  Titanium.UI.createWindow({  
          navBarHidden:true,
          backgroundColor:'#fff'
      });
      

      This doesn't:

      var win1 =  Titanium.UI.createWindow({  
          navBarHidden:true,
          backgroundColor:'#fff',
          fullscreen : false
      });
      

      — commented August 26th 2011 by John Kalberer
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.