2

I am very new to titanium when i am trying to exit from the application by clicking the button it displays the titanium splash screen again!!

I am using the following code

var win=Ti.UI.createWindow({
    backgroundColor:'#ddd',
    exitOnClose:true        
});

var button=Ti.UI.createButton({
    title:'back',
    left:10,top:10  
});

button.addEventListener('click',function(e){
    win.close();
});

var text=Ti.UI.createLabel({
    text:'Home page',
    color:'#000',
    font:{ fontSize:20} 
});

win.add(button);
win.add(text);

win.open();

How can I exit from the application through button click?

Anand
  • 5,323
  • 5
  • 44
  • 58
surendra
  • 2,217
  • 7
  • 34
  • 42

1 Answers1

8

You can simply close the application by adding following property to the first window of your application.

     exitOnClose: true

and then type the following code where you close your window

     win.close();
     var activity = Titanium.Android.currentActivity;
     activity.finish();

Reference : Exit from Titanium Application Android. Hope it solved your problem!!

Anand
  • 5,323
  • 5
  • 44
  • 58