Frage

Ich habe ein Upgrade-Tisch von 2.3.3 bis 4.0.Es funktioniert gut. Nun habe ich die ADB-Testanwendung von Beispielcode installiert. Aber es zeigt nichts.Nur ein schwarzer Bildschirm ist vorhanden, wenn ich eine attraktte USB-Maus oder -tastatur einatmet.Mouse und Tastatur funktionieren in Ordnung, aber ADB-Testanwendung zeigt nichts.

Wie kann ich testen, dass da ein USB-Zubehör-API ist, gibt es in Tablet? Kann jemand den Beispielcode dafür bereitstellen?

danke.

War es hilfreich?

Lösung

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.

Andere Tipps

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();
    }
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top