Code example for UriMatcher

Methods: addURI

0
 
    private static final UriMatcher uriMatcher;
 
    static 
    { 
        uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
        uriMatcher.addURI(packageName, "uploads", UPLOADS);
        uriMatcher.addURI(packageName, "uploads/#", UPLOAD_ID);
    } 
 
    @Override 
    public String getType(Uri uri)
    { 
        switch (uriMatcher.match(uri))
        { 
            case UPLOADS:
                return "vnd.android.cursor.dir/vnd.trovebox.photo"; 
            case UPLOAD_ID:
                return "vnd.android.cursor.item/vnd.trovebox.photo"; 
            default: