Thursday, 15 January 2015

android how can i read file or directory from usb host and copy to other place -


I need your help, I'm trying to read some directories and try to copy it in another place. I am here. Now I can connect to the USB host and read the USB specification, but I can not read the information on the USB to copy it.

This is my code

  if (ACTION_USB_PERMISSION.equals (verb)) {synchronize (this) {USBDevice device = (USBDevice) intent.getParcelableExtra (UsbManager.EXTRA_DEVICE) ; If (intent.getBooleanExtra (UsbManager.EXTRA_PERMISSION_GRANTED, incorrect)) {if (device! = Null) {// call method Device Communication byte [] bytes = new byte to set [0]; Int Timeout = 0; Boolean force climm = true; Intf = device.getInterface (0); UsbEndpoint endpoint = intf.getEndpoint (0); Connection = manager.openDevice (tool); Connection.claimInterface (intf, forceClaim); Bytes = connection.getRawDescriptors (); Toast. Make Text (Reference, "PERMISO CONCEDIDO", TOST., LNGTH_SHORT). Show (); ArrayList & lt; String & gt; Directorate = New Arrestist & lt; & Gt; (); Directorios = ObtnerDirectorios ("/ Storage / UsbDriveA"); String diamor = ""; For (Int i = 0; I & lt; Directorial size (); i ++) {Director = Director.Gate (I) + "\ n"; } Infotext.setText (dir); }} Else {Toast.makeText (Reference, "PERMISO DENEGADO", TOST.LENGTH_SHORT). Show (); }}}  

I have read the Google documentation and I think use a bulk transfer and control transfer but I'm not sure. Can you help me

Thanks


No comments:

Post a Comment