我有一个严重的问题,我有一个通过所有卡片数据的刷卡器应用程序抛出了一个 xml(xml 在我的代码中的结构方式是由 sdk 提供程序编写的)。我需要使用 2 个 EditText(1 个用于卡号,1 个用于 ExpDate)进行手动输入,然后将该数据传递给同一活动(或一个新活动)以在处理订单的 xml 中使用。这可以做到吗?如何才能做到这一点?以下是我的代码 - 编辑或更正将非常有帮助......提前谢谢你。
String tranXmlFmt =
"<?xml version=\"1.0\"?><TStream>"
+ "<Transaction>"
+ "<IpAddress>66.173.160.125</IpAddress>"
+ "<MerchantID>002649</MerchantID> "
+ "<OperatorID>50</OperatorID>"
+ "<TranType>Credit</TranType>"
+ "<CardType>VISA</CardType> "
+ "<TranCode>Sale</TranCode> "
+ "<OperatorID>55</OperatorID> "
+ "<InvoiceNo>100001</InvoiceNo>"
+ " <RefNo>100001</RefNo> "
+ "<PartialAuth>Allow</PartialAuth>"
+ "<Account>"
+ "<AcctNo>4104891389583005</AcctNo>"
+ "</Account> "
+ "<ExpDate>0214</ExpDate>"
+ "<Amount><Purchase>13.00</Purchase></Amount>"
+ "<UserTraceData>GBTE130116</UserTraceData>"
+ "</Transaction> "
+ "</TStream>";
String initXml = ""
+ "<?xml version=\"1.0\"?>"
+ "<TStream><Admin>"
+ " <MerchantID>002649</MerchantID>"
+ " <TerminalID>002</TerminalID><TranCode>SecureDeviceInit</TranCode>"
+ " <PadType>None</PadType>" + " <TranType>Setup</TranType>"
+ " <SecureDevice>UniMagSecureMagDsi</SecureDevice>"
+ " <ComPort>1</ComPort>"
+ " </Admin>"
+ "</TStream>";
'
帮助
Button btnNextScreen = (Button) findViewById(R.id.btnNextScreen);
//Listening to button event
btnNextScreen.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
//Starting a new Intent
}
});
Button btnInit = (Button) findViewById(R.id.btnInit);
btnInit.setOnClickListener(new View.OnClickListener() {
/**
* initialize epay client
*/
@Override
public void onClick(View v) {
libReady = true;
ca = new ClientActivity(getApplication(), readerType);
Log.d("MAINACTIVITY", "reader type: " + readerType.toString());
initReturn = ca.initialize(initXml);
Log.d("MAINACTIVITY", "init return: " + initXml);
libReady = true;
EditText et = (EditText) findViewById(R.id.editXml);
et.setText(initReturn);
Log.d("MAINACTIVITY", "Library Loaded");
}
});
Button btnClose = (Button) findViewById(R.id.Close_button);
btnClose.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LineDisplay ld = new LineDisplay();
ld.open(DeviceCommon.DEVICE_MODE_COMMON, null);
ld.clear();
ld.setBacklight(LineDisplay.LCD_BACKLIGHT_OFF);
ld.close();
finish();
}
});
我只需要添加 2 Edittext 并更改要在同一活动中使用的 AcctNo 和 ExpDate STRING。请任何帮助将是巨大的。