1. In regards to recently combined carrier specific root forums, if your device forum was affected, please see this poll/thread!

Android USB Communication


  1. aldocampos

    aldocampos New Member

    I am new to android programming and I am trying to set a connection with the android as a host. I have included the following imports:
    import android.content.Context;
    import android.hardware.usb.UsbDevice;
    import android.hardware.usb.UsbManager;
    import android.hardware.usb.UsbInterface;
    import android.hardware.usb.UsbEndpoint;
    import android.hardware.usb.UsbDeviceConnection;
    import android.content.Context;

    My problem is when I use this code :m_usbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
    The eclipse editor shows a message saying that getSystemService(String) is undefined for the type CPrinterCommands(The class that I am using). Quick fix gives as a solution to create a method called getSystemService, however I can

    Advertisement
  2. myrecek

    myrecek Active Member

    getSystemService is a method in class Activity. Your CPrinterCommands class probably doesn't extend Activity so you have to pass an Activity object somehow into your class/method.

Share This Page