如何使用在phonegap中创建取消和确定按钮PhoneGap.exec(null, null, "Notification", "activityStart", ["Downloading file","Please wait..."]);
问问题
644 次
2 回答
1
navigator.notification.confirm(
'Do you want to signout and close the application?', // message
onConfirm, // callback to invoke with index of button pressed
'Sign Out', // title
'Sign Out,Cancel' // buttonLabels
);
和
function onConfirm(button) {
//action for confirmation
}
参考 http://docs.phonegap.com/en/1.2.0/phonegap_notification_notification.md.html
于 2012-09-17T05:28:10.107 回答
0
请在下面指定您要应用phonegap插件(ios,android)的技术是帮助您创建android核心警报框的代码在执行方法上调用此函数
public synchronized void customalertBox(final String callBackId, JSONArray jarray) {
final AlertDialog showCustomDialog = null;
final Runnable runnable = new Runnable() {
@Override
public void run() {
AlertDialog.Builder customdialog = new AlertDialog.Builder(null);
showCustomDialog.setButton2("OK", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
customalertPLUGIN.success(new PluginResult(
PluginResult.Status.OK, setJSONDataTORETURN),
callBackId);
showCustomDialog.dismiss();
}
});
showCustomDialog.setButton2("Cancel", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
customalertPLUGIN
.error(new PluginResult(
PluginResult.Status.INVALID_ACTION),
callBackId);
showCustomDialog.dismiss();
}
});
showCustomDialog = customdialog.create();
showCustomDialog.setCancelable(true);
showCustomDialog.show();
}
};
}
希望这会对你有所帮助。留下评论
于 2012-04-12T13:20:46.320 回答