返回按钮的PhoneGap的Andr​​oid不工作 [英] Back Button not working in phonegap android

查看:164
本文介绍了返回按钮的PhoneGap的Andr​​oid不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在哪里,我使用JQM设计我的页面PhoneGap的应用程序。

I have a phonegap app where i am using JQM for designing my pages.

我面临的问题是,回来JQM产生的按钮不工作在Android平台上的某些情况下的。它工作正常的IOS虽然

The Issue i am facing is that Back Button generated by JQM is not working on android platforms on some cases. it works fine on IOS though

编辑:
它适用于浏览器了。所以我怀疑可能有一些问题,而使用科尔多瓦。

It works on Browsers too. So i suspect there may be some issue while using cordova.

我试着以下<一个href=\"http://stackoverflow.com/questions/10774608/cordova-phonegap-1-7-android-back-button-not-firing\">this帖子从1.7升级到1.8科尔多瓦,但这种力解决我的问题。

I tried following this post and upgraded to cordova 1.8 from 1.7, but this dint solve my problem.

案例的,其中返回键不能正常工作

Cases where back button is not working

我有一个从索引页调用一些JQM文件。后退按钮上没有这些文件的操作。但这些文件里面有 JQM页面的在那里后退按钮呢作品

I have few JQM files that are called from the index page. Back button is not operational on these files. but inside those files there are JQM pages where Back Button does works

后退按钮是一个标准JQM后退按钮

Back button is a standard JQM back button

<a data-role="button" data-rel="back">Back</Back>

我坚持这个,因为很长一段时间。

I am stuck on this since long time.

任何人都可以提供一些方向?

Can anyone provide some directions?

编辑:

只是为了消除任何混淆。后退按钮事件侦听器(参考并在评论建议)经营实体被调用。但是,这是设备的后退按钮(物理按键)。我的问题是与JQM的后退按钮即与数据相对后退按钮=后面的

Just to eliminate any confusion. BackButton event listener(Reference and suggested in the comments) does gets called. But this is device's back button(the physical button). My issues are with JQM's back button i.e back button with data-rel="back"

推荐答案

在没有看到您的code,我不能帮你JQM后退按钮的问题。虽然我可以提出一个新的解决方案。

Without seeing your code i cant help you with your JQM backbutton issue.. Although i can propose a new solution.

您可以注册一个后退按钮监听像这样

You can register a backbutton listener like this

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

然后在onBackClickEvent你可以使用它像这样

then in the onBackClickEvent you can use it like this

function onBackClickEvent {

var currentPageId = $.mobile.activePage.attr('id');

  if(currentpageId == 'home') {
    $.mobile.changePage("#page2",{ transition : "slide"});
  } else {...}
}

这样你可以控制你的应用程序的流程。希望这将有助于...

Like this you can control the flow of your application. Hope this will help...

这篇关于返回按钮的PhoneGap的Andr​​oid不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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