Code example for SparseArray

Methods: getsize

0
     * Gets UsbDeviceConnection by a hierarchy device number 
     * @param devNum hierarchy device number 
     * @return UsbDeviceConnection or null 
     */ 
    public UsbDeviceConnection connection(int ch) {
        if(ch >= mConnection.size()) { return null; }
        return mConnection.get(ch);
    } 
 
    /** 
     * Check whether a device is connected or not 
     * @param devNum hierarchy device number 
     * @return true:connected, false:not connected 
     */ 
    public boolean deviceIsConnected(int devNum) {
        if(connection(devNum) == null) return false;
        return true; 
    } 
 
    /** 
Stop searching for code, let great code find you!  Add Codota to your java IDE