Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (android)
Viewing all articles
Browse latest Browse all 7655

Have 'back' go to previous window instead of close the application

$
0
0

I am having a similar problem as [this one] (http://developer.appcelerator.com/question/37081/stop-the-back-button-closing-app-on-android).

Basically, I want my 'back' button (in Android) to reopen the previously opened window, instead of closing the application. However, I also want to have OptionMenu displayed.

From the referenced question, I found that the back button only works that way for heavyweight windows.

I have read on heavyweight windows from [here] (http://developer.appcelerator.com/question/32471/noob---android-menu-does-not-work) and the API docs for Titanium.UI.Window, and I have tried those with my application.

Setting modal to true makes the 'back' button go to the previous window, but it does not display my OptionMenu. I am experimenting with other values for modal, navbarHidden, and fullscreen as well. So far, the result is that I have either the OptionMenu, 'back', or none at all, never both.

When I have 'navbarHidden: false' only, I will get only OptionMenu. When I have 'modal: true', the back button will go to the previous window, but there is no OptionMenu even when 'navbarHidden: false'.

Some code to illustrate my point:

var winA = Titanium.UI.createWindow({  
    title:'Window A',
    backgroundColor:'#fff',
    navbarHidden: false, // will show OptionMenu, but 'back' closes the app
});
 
var winB = Titanium.UI.createWindow({
    title: 'Window B',
    backgroundColor: '#fff',
    navbarHidden:false, 
    modal:true // 'back' goes to previous window but no OptionMenu
});
Can anyone shed a light on this?

Thanks in advance.

Note: I'm currently using SDK continuous-1.4.3.


Viewing all articles
Browse latest Browse all 7655

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>