-3

I am pretty new in the programming world. I am using Titanium, and I want a button that when I clicked on it, it will go back to the home window. Obviously, the button will be in another window.

I tried win2.open() and win2.show(), but it is not working. Any ideas?

rene
  • 41,474
  • 78
  • 114
  • 152
Jack
  • 3
  • 1

2 Answers2

0

Jacl,

If you are in second window, just close that window on the click event of your button in the second window. Try the following in second window

//I'm assuming that you have came from window1 to window2
//and you have a button btnHome at window 2 used to navigate back to home page

var thisWindow = Ti.UI.currentWindow;
btnHome.addEventListener('click', function(e){
    thisWindow.close(); //Will close the current window and display the previous one
});

There is a similar question which is used to navigate between windows. Go through Titanium Mobile: cant navigate between pages.

You can use the following links also for references

  1. http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.Window-property-url
  2. http://docs.appcelerator.com/titanium/latest/#!/api/Global-method-require
Community
  • 1
  • 1
Anand
  • 5,323
  • 5
  • 44
  • 58
0

Use titanium navigational controller

https://github.com/vuinguyen/Ti-Navigation-Controller

it would give you button for previous and home window

rene
  • 41,474
  • 78
  • 114
  • 152
Wahhab_mirza
  • 1,484
  • 2
  • 10
  • 17