I want to establish serial communication between Android and Arduino. My Android device supports OTG. When I run this code, I get empty result. (I've tried SanDisk USB, Arduino, USB Bluetooth).
TextView tv = (TextView)findViewById(R.id.text);
tv.setText("Hello");
UsbManager manager = (UsbManager) getSystemService(Context.USB_SERVICE);
HashMap<String, UsbDevice> deviceList = manager.getDeviceList();
Iterator<UsbDevice> deviceIterator = deviceList.values().iterator();
while(deviceIterator.hasNext()) {
UsbDevice device = deviceIterator.next();
tv.setText(device.getDeviceName());
AndroidManifest;
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="19" />
<uses-feature android:name="android.hardware.usb.host" />
<uses-permission android:name="android.hardware.usb.host"/>
Where is my error? (Sorry for my bad English.)