6 Replies Latest reply on Apr 21, 2016 8:26 AM by Manuel Caicedo-Rivera

    How to run ZPL on thread? - printimage is non blocking, but seems to die if I call Thread.sleep or any other printer status check

    Greg Mort

      If I do this


      Nothing happens

      new Thread(new Runnable() {    public void run() {   Connection connection;   String hardcodedmac = "ac3fa446767d";   connection = new BluetoothConnection(hardcodedmac);     try {    connection.open();   ZebraPrinter printer = ZebraPrinterFactory.getInstance(connection);   printer.printImage(new ZebraImageAndroid(sigImage), 0, 0,sigImage.getWidth()/4, sigImage.getHeight()/4, true);     } catch (ConnectionException e) {   e.printStackTrace();   } catch (ZebraPrinterLanguageUnknownException e) {   e.printStackTrace();   } finally {    try {   connection.close();   } catch (ConnectionException e) {   e.printStackTrace();   }    }   }    }).run();



      If I add a thread.sleep, or PrinterStatus printerStatus = printer.getCurrentStatus();

      it stops printting.... if I make a counter that counts to 100000 with no sleep, then it prints...


      What is going on? Why is this happening?