我想制作和 API 在斑马打印机上打印票,我有我的主要活动(仅用于测试):
public class ZebraPrinterActivity extends Activity {
public EditText macAddress;
public Button testButton;
public Printer zebra;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
macAddress = (EditText) this.findViewById(R.id.editText1);
testButton = (Button) this.findViewById(R.id.button1);
zebra = new Printer(new ZebraPrinterActivity());
testButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
new Thread(new Runnable() {
public void run() {
}
}).start();
}
});
}}
我有我的类(API)称为打印机:
public class Printer {
private ZebraPrinterConnection zebraPrinterConnection;
private ZebraPrinter zebra;
private String MAC;
public Printer (Activity activity) {
zebraPrinterConnection = null;
zebra = null;
activity....get Edit Text
this.MAC = MAC;
}}
我需要的是从早期活动中获取编辑文本,有没有办法做到这一点?