Back to previews page with android back button


#1

Hi. My app structure is like below :

<div id="app">
            <!-- Status bar overlay for fullscreen mode-->
            <div class="statusbar"></div>
            <!-- Views/Tabs container -->
            <div class="views tabs ios-edges">
                <!-- Your main view/tab, should have "view-main" class. It also has "tab-active" class -->
                <div id="view-home" class="view view-main tab tab-active">
                    <!-- Page, data-name contains page name which can be used in page callbacks -->
                    <div class="page" data-name="home">
                       .....
                    </div>
                </div>
                <!-- Catalog View -->
                <div id="view-catalog" class="view tab"></div>
                <!-- Settings View -->
                <div id="view-settings" class="view tab">
                    <div class="list">
                        <ul>
                            <li>
                                <a href="#" class="item-content item-link popup-open" data-popup="#myadss_popup" >
                                    ...
                                </a>
                            </li>
                        </ul>
                    </div>
                </div></div>
           
            <!-- My Adss -->
            <div class="popup " id="myadss_popup">
                <div class="view">
                    <div class="page page-current" id="myadss_page">.....</div>
                        </div>
                    </div>
                    <div class="page page-next" data-name="open_edit" id="open_edit"></div>
        </div>

When I click on the android back button application will close but I want to come back to the previews page. What do I have to do? For example from open_edit page to the myadss_page page.


#2

you should listen to backbutton event

// listen to deviceready event
function onDeviceReady() {
  // ..some code here
  document.addEventListener("backbutton", onBackKeyDown, false);
  // ...more code
}

and

function onBackKeyDown() {
  // your code here
}

#3

Hi .I know that and I was using from this code :
function onBackKeyDown() {
var app = new Framework7({});
var page = getCurrentView(app);
app.dialog.alert(page);
if (page.name == “index”) {
app.dialog.confirm(AppExitMessage, “exit”, exitOk, exitCancel);
} else {
navigator.app.backHistory();
}
function exitOk() {
if (navigator.app) {
navigator.app.exitApp();
} else if (navigator.device) {
navigator.device.exitApp();
} else {
window.close();
}
}
function exitCancel() {
return false;
}
}
But when I click on the back button (android) It hasn’t any reaction.I think I have a problem in how do I have to use from view structure in my application.


#4

But it doesn’t work and I have any reaction after backbutton action.