Hi! I am trying an USB host connection, and so far I've managed to make connection with a interrupt endpoint. The problem lays on trying to read data from this endpoint. Everytime i call request.queue the application crash. The code is as folllows:
@Override public void run() { // STARTS EXECUTING THE CONNECTION ByteBuffer buffer = ByteBuffer.allocate(5); // read data from the interrupt endpoint. For IN endpoints, // the endpoint will attempt to read the given number of bytes // into the specified buffer. UsbRequest request = new UsbRequest(); request.initialize( connection, ep ); while (true){ textView6.setVisibility(View.VISIBLE); // queue a request on the interrupt endpoint request.queue(buffer, 5); // requestWait() a completed USB request, or null if an error occurred if (connection.requestWait() == request) { byte[] data = buffer.array(); String str = new String( data); textView6.setText( str ); } else { Toast toast = Toast.makeText(getApplicationContext(), "Request for data failed.", Toast.LENGTH_SHORT); toast.show(); } } } } -- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.