我调试我的应用程序然后我尝试在漂亮的对话框按钮上快速单击两次并打印两次我希望即使我单击两次它也不会打印两次。
我尝试了错误处理程序代码,但没有用。
prettyDialog.addButton("YES",
R.color.navy_blue,
R.color.gold_yellow,
new PrettyDialogCallback() {
@Override
public void onClick() {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
raw_serial = String.valueOf(Build.SERIAL);
serial_final = raw_serial.substring(raw_serial.length() - 7);
nf = new DecimalFormat("000000");
DateFormat dateFormat = new SimpleDateFormat("MMddyyyy");
Date date = new Date();
ticket_date = dateFormat.format(date).toString();
DateFormat datetimeformat = new SimpleDateFormat("HHmmss");
Date time = new Date();
ticket_time = datetimeformat.format(time).toString();
transaction_no = serial_final + ticket_date + ticket_time + nf.format(setting_last_transaction_no);
trace_no = merchant_code + serial_final + ticket_date + ticket_time + nf.format(ref_trace_no);
print_card_no = Cardno.substring(Cardno.length() - 4);
String print_balance;
print_balance = "P" + String.valueOf(Balance);
int balancespace = 0;
int balancelength = 0;
balancelength = print_balance.length();
balancespace = 13 - balancelength;
for (int j = 0; j < balancespace; j++) {
print_balance = " " + print_balance;
}
int print = PrinterInterface.open();
Log.e("print", String.valueOf(print));
int querystatus = PrinterInterface.queryStatus();
Log.e("querystatus", String.valueOf(querystatus));
我希望即使我单击“是”漂亮的对话框按钮也不会打印两次。
慕桂英3389331
相关分类