Android back button closes my application

You must Login before you can answer or comment on any questions.

I am using android 2.3.3 and 1.7.1 titanium studio. I am opening google on click of a label in a new webview. The site gets open also , but now i want to go back to my previous page when i click the android back button it gets out of my application. I tried to use android:back in event listener but nothing happened.

My code is

var label14= Titanium.UI.createLabel({
         label14.addEventListener('click', function(e){
            var webView1 = Titanium.UI.createWebView({
            win.addEventListener('android:back', function() {

2 Answers

Accepted Answer

What is the window definition for win? It just needs something like 'fullscreen : false' added to the attrributes to make it a heavyweight..

So something like

var win=Ti.UI.createWindow({
    fullscreen : false,
If win IS your top window, then you need to define a new one - call it win2 or something and make it heavyweight, and add the webview to that.

— answered 4 years ago by Steve Hovey
answer permalink
1 Comment
  • Fixed the problem for me (for now). Until I find a more correct feeling way to make heavyweight windows, or figure out how to use lightweight windows correctly.

    — commented 3 years ago by Chris Raastad

lightweight windows all sort of count as the window they came from so it goes out of your app.. if open the webview in a heavy weight window, then back would only close that.

Your Answer

Think you can help? Login to answer this question!