赞
踩
MainActivity.java部分代码如下:View.OnClickListener listener = new View.OnClickListener()
{
@Override
public void onClick(View v)
{
if (v == buttonGetDevices)
{
UsbManager manager = (UsbManager) getSystemService(Context.USB_SERVICE);
HashMap deviceList = manager.getDeviceList();
Log.i(TAG, "get device list = " + deviceList.size());
m_TxtVIewOfDeviceSize.setText(tv.getText() + "Device size:" + deviceList.size() + "\n");
Iterator deviceIterator = deviceList.values().iterator();
while (deviceIterator.hasNext())
{
UsbDevice device = deviceIterator.next();
Log.i(TAG, "device name = " + device.getDeviceName());
}
}
}
};
AndriodManifest.xml 文件部分代码如下:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。