Code example for Uri

Methods: getAuthority, toString

0
 
    /* 
     * Get rid of the last '/' if any 
     */ 
    private String sanifyPath(Uri uri) {
        String path = uri.toString().substring(uri.getAuthority().length() + CONTENT_LENGHT);
        // removing trailing / 
        if (path.charAt(0) == '/') {
            path = path.substring(1);
        } 
        return path;
    } 
 
    public T get(Uri uri) {
        return get(uri, null, true);
    } 
 
    public T get(Uri uri, T defaultValue) {
        return get(uri, defaultValue, false);
    }