I am working on a project about android and I am trying to set a connection between device and ADK my problem is .getAccessory();
method. It should be taken from UsbManager class, but eclipse throws following error:
The method getAccessory(Intent) is undefined for the type UsbManager
And my code sample is here:
private final BroadcastReceiver mUsbReceiver = new BroadcastReceiver(){
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
String action = intent.getAction();
if(ACTION_USB_PERMISSION.equals(action)){
synchronized (this) {
UsbAccessory accessory = UsbManager.getAccesory(intent);
if(intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false)){
openAccessory(accessory);//q
}
}
}
else if (UsbManager.ACTION_USB_ACCESSORY_DETACHED.equals(action)){
UsbAccessory accessory = UsbManager.getAccessory(intent);
if(accessory != null && accessory.equals(mAccesory)){
closeAccessory();//q
}
}
}
};
Do you have any idea what to do?
Maybe I am wrong, in this case what can I use for its task?
Edit: JVM cannot see the getInstance()
method too which I used in OnCreate(Bundle savedInstanceState)
.
I have just done my project build target 4.0.3 to Google APIs(API lvl 17) and it was solved