Code example for UsbDevice

Methods: getInterfacegetInterfaceCount

0
 
	} 
 
	private void setDevice(UsbDevice device) {
		Context context = getApplicationContext();
		if (device.getInterfaceCount() != 1) {
			Toast toast = Toast.makeText(context, "could not find interface", duration);
			toast.show();
			return; 
		} 
		UsbInterface intf = device.getInterface(0);
		// device should have two endpoints 
		if (intf.getEndpointCount() != 2) {
			Toast toast = Toast.makeText(context, "could not find endpoint", duration);
			toast.show();
			return; 
		} 
 
		// endpoint should be of type bulk 
		UsbEndpoint ep = intf.getEndpoint(0);
Stop searching for code, let great code find you!  Add Codota to your java IDE