TheMightySwe Active Member Licensed User Longtime User Dec 30, 2015 #1 This is the original handler code from a LAN Printer SDK, how do you initialize it to work with a B4A Application. B4X: private final Handler sHandler = new Handler(new Handler.Callback() { public boolean handleMessage(Message msg) { switch (msg.what) { case MetapacePrinter.MESSAGE_NETWORK_DEVICE_SET: if (msg.obj != null) { Set<String> ipAddressSet = (Set<String>) msg.obj; for (String ipAddress : ipAddressSet) { if (ipAddress.equals("192.168.0.100")) { // TODO: Connect printer break; } } } break; } return true; } });
This is the original handler code from a LAN Printer SDK, how do you initialize it to work with a B4A Application. B4X: private final Handler sHandler = new Handler(new Handler.Callback() { public boolean handleMessage(Message msg) { switch (msg.what) { case MetapacePrinter.MESSAGE_NETWORK_DEVICE_SET: if (msg.obj != null) { Set<String> ipAddressSet = (Set<String>) msg.obj; for (String ipAddress : ipAddressSet) { if (ipAddress.equals("192.168.0.100")) { // TODO: Connect printer break; } } } break; } return true; } });
Erel B4X founder Staff member Licensed User Longtime User Dec 30, 2015 #2 The handler is used to communicate between two threads. You cannot create a handler directly in B4A. You will need to write a small library for this.
The handler is used to communicate between two threads. You cannot create a handler directly in B4A. You will need to write a small library for this.