应用中只有一个NavigationView的情况:
// 处理一下android返回按钮document.addEventListener("deviceready", onDeviceReady, false);function onDeviceReady() {document.addEventListener("backbutton", onBackKeyDown, false);}function onBackKeyDown() {var canPop = false;var id = Ext.Viewport.getActiveItem().id;if (id.indexOf("login") != -1) {} else if (id.indexOf("mainview") != -1) {var mainview = Ext.Viewport.getActiveItem();var length = mainview.getItems().length;if (length > 2) {canPop = true;}}if (canPop) {console.log("canPop");ChinaFertilizer.app.getController("MainController").pop(1);} else {Ext.Msg.confirm("提示", "您确定要退出应用吗?", function(e) {if (e == "yes") {navigator.app.exitApp();}}, this);}}



在Ext.tab.Panel下有多个NavigationView的情况:
// 处理一下android返回按钮document.addEventListener("deviceready", onDeviceReady, false);function onDeviceReady() {document.addEventListener("backbutton", onBackKeyDown, false);}function onBackKeyDown() {var item = Ext.Viewport.getActiveItem();var id = item.id;if (id.indexOf("mainView") != -1) { var mainview = Ext.Viewport.getActiveItem();// var mainview = Ext.getCmp('moreView').getActiveItem(); var length = mainview.getActiveItem().getItems().length; console.log("length = " + length); if(length > 2){ if(app.viewId == 0){ app.getController("phone.MyAppControllerP").pop(1); }else if(app.viewId == 1){ app.getController("phone.TodoControllerP").pop(1); }else if(app.viewId == 2){ app.getController("phone.AppCenterControllerP").pop(1); }else if(app.viewId ==3){ app.getController("phone.MoreControllerP").pop(1); } }else{ if (typeof WL === 'undefined') { Ext.Msg.confirm("提示", "您确定要退出应用吗?", function(e) { if (e == "yes") { navigator.app.exitApp(); } }, this); } else { WL.SimpleDialog.show("提示", "您确定要退出应用吗?", [ { text : "确定", handler : function() { navigator.app.exitApp(); } }, { text : "取消", handler : function() { } } ]); }  } }else{ if (typeof WL === 'undefined') { Ext.Msg.confirm("提示", "您确定要退出应用吗?", function(e) { if (e == "yes") { navigator.app.exitApp(); } }, this); } else { WL.SimpleDialog.show("提示", "您确定要退出应用吗?", [ { text : "确定", handler : function() { navigator.app.exitApp(); } }, { text : "取消", handler : function() { } } ]); } }

更多相关文章

  1. android如何查看app的内存占用情况
  2. 给Android的音量按钮添加监听事件
  3. 拷贝的Android源码不能单独编译mmm命令提示找不到
  4. Android在配置文件中配置Button再不同情况下的的背景
  5. 多个按钮左右相互挤压效果
  6. Android Material Design按钮样式设计
  7. Android 中英文切换(点击按钮切换语言)
  8. android logcat鼠标悬浮提示过快

随机推荐

  1. 什么是字节码?python字节码详细介绍!
  2. 实现多文件上传案例 以及 MVC与依赖注入
  3. 对接一个新的项目或者新的工作
  4. 彻底搞定HashMap面试问题!!!
  5. 3-7(单链表的相关算法题)
  6. MySQL基础知识——管理和连接
  7. 使用graylog2收集dhcp日志
  8. MySQL基础知识——安装
  9. 这该死的游标,怎么这么难呢?
  10. LVS NAT原理、配置