nilkash
nilkash

Reputation: 7536

Titanium device back button not closes my application properly

I am working Android mobile application using Titanium studio.I have developed small application.After logging into application will display two tabs on my new window; after clicking any other tab it opens correct window.But when I click device back button (back button on my android phone simulator) it not closes my application. it render one blank window and if I again click back button it closes my application

after log in successful I used window-name.close(); so that it not render again sign in form. But I am using .close() for only sign in window so that after clicking back it will not show sign in page again.

var user1 = Ti.UI.createWindow
({
        navBarHidden : false,
        url:'main.js',
});user1.open();
w.close();
home.close();

========== main=============

var mainTabGroup = Titanium.UI.createTabGroup();

var feedWin = Titanium.UI.createWindow({
    url:'home/feed.js'
});
var feedTab = Titanium.UI.createTab({  
    title:'Feed',
    window:feedWin
});
var listWin = Titanium.UI.createWindow({
    url:'home/list.js'
});
var listTab = Titanium.UI.createTab({  
    title:'List',
    window:listWin
});

mainTabGroup.addTab(feedTab);
mainTabGroup.addTab(listTab);
mainTabGroup.open();

Upvotes: 2

Views: 3637

Answers (1)

Aaron Saunders
Aaron Saunders

Reputation: 33345

you need to set

exitOnClose:true

on whichever window you want to trigger the closing of the app when that window is closed

From the appcelerator documentation, Titanium.UI.Window

(Android only.) Boolean indicates if the application should exit when the Android back button is pressed while the window is being shown. You can only set this as a createWindow({...}) option. Setting it after window creation will no effect.

Upvotes: 2

Related Questions