我想使事情发生时,后退按钮是pressed所以我把这个code。在我的应用程序的.js文件:
I want to make something happen when back button is pressed so I put this code in my app's .js file:
function wlCommonInit(){
// Common initialization code goes here
WL.App.overrideBackButton(backFunc);
}
function backFunc(){
alert('You will back to previous page');
}
构建和部署应用程序,并在设备上运行后,警报显示,当我preSS后退按钮。
After building and deploying the application and running it in a device, the alert is shown when I press the Back button.
如果我现在退出由pressing应用程序上的主页按钮,杀死应用程序的过程,然后再次打开应用程序和preSS后退按钮 - 这是行不通的。
If I now exit the app by pressing on the Home button and kill the app's process, and then open the app again and press the Back button - it doesn't work.
将code INSIDE wlCommonInit()。我建议这样做以这种方式:
Place your code INSIDE wlCommonInit(). I suggest to do so in this manner:
function wlCommonInit() {
WL.App.overrideBackButton(backFunc);
}
function backFunc() {
alert('You will back to previous page');
}
修改:问题更新上述code片段,并根据意见的新信息。情景工作正常。见注释。
Edit: Question updated with the above code snippet and new information based on the comments. Scenario works fine. See comments.
上一篇:FragmentTransaction .attach和.detach的动作条的标签动作、标签、FragmentTransaction、attach
下一篇:的Visual Studio 2012后生成事件 - 错误code 255错误、事件、Studio、Visual