Code example for Uri

Methods: query, getPath, getScheme, toString

0
        public String type;
    }; 
     
    public static FileInfo getFileInfoFromURI(Context aContext, Uri uri) throws IllegalArgumentException {
        FileInfo info = new FileInfo();
        if (uri.getScheme().equals("file")) {
            info.path = uri.getPath();
            return info;
        } 
         
        if (uri.toString().startsWith("content://org.openintents.filemanager/")) {
            // Work around URI escaping brokenness 
            info.path = uri.toString().replaceFirst("content://org.openintents.filemanager", "");
            return info;
        } 
         
        Cursor cursor = aContext.getContentResolver().query(uri, null, null, null, null);
        cursor.moveToFirst();
         
        int dataIdx = cursor.getColumnIndex(MediaStore.Images.Media.DATA);
         
        if (dataIdx != -1)