Runnable如何传参
Posted 灯火、阑珊处
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Runnable如何传参相关的知识,希望对你有一定的参考价值。
private class TimerUpdateTask implements Runnable{ private boolean isUnion = false; public TimerUpdateTask(boolean isUnion){ this.isUnion = isUnion ; } @Override public void run() { String printMsg = ""; String mSerialNumber = out_trade_no; final String guideInfo = guideinfo; if (this.isUnion) { UnionPayDialog.dismissUnionDialog(); PayResultDialog.showPayResultDialog(getContext(), true, mUnionPayResult.getOrderNum(), mUnionPayResult.getConfirmNum(), ALLPrize + "", "", "003136"); printMsg = PrintMsgAndDialogUtils.setPrintMsg(myApplication, 3, mCardNo, mPatientName, "门诊缴费", "", patientInfo, ALLPrize + "", mSerialNumber,choosedBean.get(0).getOrderID(),invoiceNo); LogSaverUtils.saveTradePrintLog(mUnionPayResult.getConfirmNum(), printMsg + "\n" + guideInfo + "\n\n\n\n\n"); LogSaverUtils.sendAndSaveUnionTradeLog(myApplication, getContext(), "1", mUnionPayResult, "门诊缴费", secondTrackData, field55, cardSN, patientInfo, mPatientID, mPatientName, TransMoneyUtils.transMoney(ALLPrize+"")); } else { QRCodePayDialog.dismissQRCodeDialog(); // PayResultDialog.showPayResultDialog(getContext(), true, transaction_id, out_trade_no, ALLPrize + "", "", "003136"); PayResultDialog.showPayResultDialog(getContext(), true, out_trade_no, out_trade_no, ALLPrize + "", "", "003136"); LogSaverUtils.saveQRTradeLog(out_trade_no, "支付成功,确认缴费成功" + LogSaverUtils.getQRSaveLog(out_trade_no, mPatientName, ALLPrize + "")); printMsg = PrintMsgAndDialogUtils.setPrintMsg(myApplication, isWeixinPay ? 2 : 1, mCardNo, mPatientName, "门诊缴费", "", patientInfo, ALLPrize + "", mSerialNumber,choosedBean.get(0).getOrderID(),invoiceNo); LogSaverUtils.saveTradePrintLog(out_trade_no, printMsg + "\n" + guideInfo + "\n\n\n\n\n"); QRCodePayDialog.dismissQRCodeDialog(); // PayResultDialog.showPayResultDialog(getContext(), true, transaction_id, out_trade_no, ALLPrize + "", "", "003136"); PayResultDialog.showPayResultDialog(getContext(), true, out_trade_no, out_trade_no, ALLPrize + "", "", "003136"); LogSaverUtils.saveQRTradeLog(out_trade_no, "支付成功,确认缴费成功" + LogSaverUtils.getQRSaveLog(out_trade_no, mPatientName, ALLPrize + "")); printMsg = PrintMsgAndDialogUtils.setPrintMsg(myApplication, isWeixinPay ? 2 : 1, mCardNo, mPatientName, "门诊缴费", "", patientInfo, ALLPrize + "", mSerialNumber,choosedBean.get(0).getOrderID(),invoiceNo); LogSaverUtils.saveTradePrintLog(out_trade_no, printMsg + "\n" + guideInfo + "\n\n\n\n\n"); } if (prescription.getResultInfo().size() > 0) { mPrescriptionAdapter.removePosition(choosedBean.get(0)); info_dptnam.setText("-"); info_docname.setText("-"); info_money.setText("-"); } final String finalPrintMsg = printMsg; PayResultDialog.setPrintClickListener(new View.OnClickListener() { @Override public void onClick(View v) { PayResultDialog.dismissPayResultDialog(); PrintMsgAndDialogUtils.showPrintDialog(getContext()); if (UrlConf.shouji) { new Handler().postDelayed(new Runnable() { @Override public void run() { PrintMsgAndDialogUtils.printChangeFinishView(); } }, 3000); } else { Bitmap qrBitmap = null; try { qrBitmap = QRCodeUtil.CreateOneDCode(mPatientID, 400, 200); } catch (WriterException e) { e.printStackTrace(); } PrinterUtils.getInstances(getContext()).startPrint(finalPrintMsg, guideinfo + "",qrBitmap); PrinterUtils.getInstances(getContext()).setPrintFinishListener(new PrintFinishListener() { @Override public void onPrintSuccess() { PrintMsgAndDialogUtils.printChangeFinishView(); } @Override public void onPrintFailed() { } }); } } }); } }
timerUpdateHandler = new Handler(); TimerUpdateTask timerUpdateTask = new TimerUpdateTask(isUnion); timerUpdateHandler.postDelayed(timerUpdateTask,5000);
以上是关于Runnable如何传参的主要内容,如果未能解决你的问题,请参考以下文章