我将升级表从2.3.3到4.0升级。它正常工作。 现在,我已从示例代码安装了ADB测试应用程序。 但它没有任何东西。只有黑屏就在我身份,当我ATCTACTOCHEACHEACHEAS鼠标或键盘时.Mouse和键盘工作正常,但adb测试应用程序不显示任何东西。

如何测试它有没有USB附件API是平板电脑? 任何人都可以为此提供示例代码吗?

谢谢。

有帮助吗?

解决方案

Upgrading the Android device from 2.3.3 to 4.0 may not enough to make sure that it will support accessory mode required by ADK. Check the kernel version of the ROM. If it below 2.6.., then most probably it does not support the accessory mode.

其他提示

Try this, taken from http://developer.android.com/guide/topics/usb/accessory.html

UsbAccessory mAccessory;
ParcelFileDescriptor mFileDescriptor;
FileInputStream mInputStream;
FileOutputStream mOutputStream;

...

private void openAccessory() {
    Log.d(TAG, "openAccessory: " + accessory);
    mFileDescriptor = mUsbManager.openAccessory(mAccessory);
    if (mFileDescriptor != null) {
        FileDescriptor fd = mFileDescriptor.getFileDescriptor();
        mInputStream = new FileInputStream(fd);
        mOutputStream = new FileOutputStream(fd);
        Thread thread = new Thread(null, this, "AccessoryThread");
        thread.start();
    }
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top