Exit from application via button in titanium

titanium, titanium-mobile

Solution

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!!

Problem

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?

Original source