0
votes

I am developing a Sencha Touch application. I have 2 pages in my application. I have a button in my first page. When I click on the button, it goes to the second page by the following code:

Ext.Viewport.setActiveItem(Ext.create('Appname.view.ViewName'));

Now when I deploy my application on device, and press device back button, it directly comes out of the application. It does not return to the first screen

I know there is navigation view for this, but I dont want to use it. I want that when the user presses device back button, then the user should be returned to the first page. Any help is appreciated.

1

1 Answers

0
votes

You have to define routes in your Controllers. See the Ext documentation. So switching back to the previous view will be possible.

Here is an Example for you:

Ext.define('XXX.controller.Home', {
    extend: 'Ext.app.Controller',

    config: {
        refs: {
            // ...
        },
        routes: {
            'home': 'showHomeView'
        }
    },

    // ...

    showHomeView: function () {

    }
}