I am playing with my first PhoneGap/Android app, and am having trouble triggering $.mobile.changePage()
from a PhoneGap/Cordova Event.
I've updated the code, whereas before it would trigger once. Now it does not trigger at all, but is closer to how it probably should be done.
Here is my code:
$(document).on('pageinit', function() {
document.addEventListener("searchbutton", onSearchKeyDown, false); //never fires
document.addEventListener("menubutton", onMenuKeyDown, false); //never fires
alert("triggered"); //does fire
});
// search button press
function onSearchKeyDown() {
//change to search page
alert("search");
$.mobile.changePage("#page4", {transition: "pop"});
}
//menu button press
function onMenuKeyDown() {
//change to start page
alert("menu");
$.mobile.changePage("#page1", {transition: "pop"});
}