科尔多瓦的PhoneGap 1.7的Andr​​oid后退按钮不触发 [英] Cordova, PhoneGap 1.7 Android back button not firing

查看:144
本文介绍了科尔多瓦的PhoneGap 1.7的Andr​​oid后退按钮不触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用在Android 1.7科尔多瓦,它似乎是工作(即:我可以选择从图库例如图像),但我不能后退按钮事件触发。当pressing后退按钮的应用程序将自动关闭。我的构建目标是Android 2.2的。

我把这个在 onReady 方法,正如在API中规定的:

  document.removeEventListener(后退按钮,onBackKeyDown,FALSE);

我是什么失踪?


解决方案

  document.addEventListener(后退按钮,onBackKeyDown,FALSE);功能onBackKeyDown(){
   //这里做什么
   警报('回按钮被按下');

}

的addEventListener,不删除事件

I am using Cordova 1.7 on Android, and it seems to be working (i.e: I can select an image from the gallery for example) but I can't get the back button event to fire. When pressing the back button the app automatically closes. My build target is Android 2.2.

I put this in the onReady method, exactly as the stated in the API:

document.removeEventListener("backbutton", onBackKeyDown, false);

What am I missing?

解决方案

document.addEventListener("backbutton" , onBackKeyDown, false);     

function  onBackKeyDown(){    
   // Do something here    
   alert('back button was pushed');    

}

addeventlistener, not remove event

这篇关于科尔多瓦的PhoneGap 1.7的Andr​​oid后退按钮不触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆