Navigation from windows - android back

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

Hi Im working on an android app with tabgroup. The problem is that i want to keep the tab visible even if opening a new window from within a tabs window.

I have tried using both heavyweight and lightweight window but the problem is:

Lightweight window: Back button makes the app close. It should go back to the previous window

Heavyweight window: Opens over the entire screen. Tabgroup is hidden. I have tried to use settings with top and height/width, but it seems like Heavyweight window always use the whole screen.

So what do i do ? Lightweight messes up the back navigation and heavyweight hides the tabgroup.

Please help

Thanks

Tom

4 Answers

Accepted Answer

What win variables? I think you need to maintain a global window stack if you want the ability to jump to home page

You need to listen for the android: back event and determine what action to take.

Also look at the documentation on exitOnClose

— answered 8 months ago by Aaron Saunders
answer permalink
2 Comments
  • Hi. Allready tried having an eventlistener for back with lightweight window. But i cant get back to the previous window.

    Since i potent. could have a stack of windows, i want to be able to go back to the previous, until im at root level.

    What would be best if i could have a heavyweight window that i could controll the position and height /width on.

    exitOnClose does nothing.

    Thanks

    Tom

    — commented 8 months ago by Tom Jakobsen

  • It looks like you implemented exactly what I suggested, confuse to what the new issue is?

    — commented 8 months ago by Aaron Saunders

Hmmm. Maybe i got the fix

I create a lightweight window and have a event listener. on the back button. From the previous window i opened i send the parentid, and so i first when the back button is clicked i just create a new window and close the one im in.

var win = Titanium.UI.currentWindow;
win.addEventListener('android:back', function(e){
var contentwindowm = Titanium.UI.createWindow({
        url:'android.js',
        height:win.height,
        width:win.height,
        title:win.title,
        id:win.id,
        type:win.type,
        content:win.content,
        parent:win.parent,
        backgroundColor:win.backgroundcolor,
        backgroundimage:win.backgroundimage,
        companyID:win.companyID
    });
    win.close(); //close the window that you where in
    contentwindowm.open(); // open the new window
});
It seems like its working, but if any1 got any input on maybe this is not a good method i would appreciate it.

Thanks

Tom

— answered 8 months ago by Tom Jakobsen
answer permalink
1 Comment
  • Seems like i was a little fast putting this out. Can any1 tell me how to get the win variables availabile in the eventlistener?

    Thanks

    Tom

    — commented 8 months ago by Tom Jakobsen

Hi. Yeah i wanted to jump back to the parent page/window. Tried to set the parent as a global variable and update it on onclick opening the page., but it seems like when the eventlistener fires with back click i only get the id of the first window.

Hmm. a little stuck here again.

Thanks

Tom

Your Answer

Think you can help? Login to answer this question!