好了朋友们。
我正在使用 BrotherSDK 构建一个小型 POC,我要做的就是返回标签打印机列表及其纸张尺寸。我已经读过,为了做到这一点,我必须使用Promise.resolve
ReactBridge 中的函数。
我试过了,但在我的模拟器上出现这样的错误。
我的 Java 代码如下所示:
@ReactMethod
public void getPrinterList(final Promise promise) {
try {
ArrayList<String> printerList = new ArrayList<>();
Collections.addAll(printerList, "QL710W", "QL720NW",
"PTE550W",
"PTE500",
"PT750W",
"PTD800W",
"PTE800W",
"PTE850TKW",
"PTP900W",
"PTP960NW",
"QL810W",
"QL800",
"QL820NWB",
"PTP300BT",
"QL1100",
"QL1110NWB",
"QL1115NWB",
"PTP710BT");
String [] retArray = new String[printerList.size()];
retArray = printerList.toArray(retArray);
WritableArray promiseArray = Arguments.createArray();
for(int i=0; i < retArray.length; i++){
promiseArray.pushString(retArray[i]);
}
promise.resolve(promiseArray);
} catch (Exception e) {
e.printStackTrace();
}
}
@ReactMethod
public void getPaperSizes(final Promise promise) {
try {
List<String> paperSizeList = new ArrayList<>();
Collections.addAll(paperSizeList, "W17H54",
"W17H87",
"W23H23",
"W29H90",
"W29H42","W38H90",
"W39H48",
"W52H29",
"W54H29",
"W62H29",
"W62H100",
"W60H86",
"W12","W29", "W38",
"W50", "W54",
"W62", "W62RB");
侃侃无极
相关分类