39,082
社区成员
发帖
与我相关
我的任务
分享
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
document.addEventListener("backbutton", onBackButton, false);
}
function onBackButton() {
if(Ext.os.is('Android')) {
var id = Ext.Viewport.getActiveItem().getActiveItem().id;
if(id.indexOf('userview') != -1) {
alert('exit');
navigator.notification.confirm(
'您确定要退出应用吗?', // message
function(buttonIndex){
if(buttonIndex == 2){
navigator.app.exitApp();
}
}, // callback to invoke with index of button pressed
'提示', // title
'取消,确定' // buttonLabels
);
}
}
}