Code example for UsbManager

Methods: openAccessory

0
    private ParcelFileDescriptor fileDescriptor;
    private FileInputStream input;
    private FileOutputStream output;
 
    protected void openAccessory(UsbAccessory accessory) {
	fileDescriptor = mUsbManager.openAccessory(accessory);
	if (fileDescriptor != null) {
	    mAccessory = accessory;
	    FileDescriptor fd = fileDescriptor.getFileDescriptor();
	    input = new FileInputStream(fd);
	    output = new FileOutputStream(fd);
 
	    Thread t = new Thread(this, "Heart Monitor");
	    t.start();
 
	    Log.d(TAG, "accessory opened");
	} else { 
	    Log.d(TAG, "accessory open fail");
	} 
 
Stop searching for code, let great code find you!  Add Codota to your java IDE