Code example for Uri

Methods: buildUpon

0
 
    public static Uri getUriFor(Context context, Path path) {
        if (sBaseUri == null) {
            sBaseUri = Uri.parse("content://" + context.getPackageName() + ".provider");
        } 
        return sBaseUri.buildUpon()
                .appendEncodedPath(path.toString().substring(1)) // ignore the leading '/'
                .build();
    } 
 
    @Override 
    public int delete(Uri uri, String selection, String[] selectionArgs) {
        throw new UnsupportedOperationException();
    } 
 
    // TODO: consider concurrent access 
    @Override 
    public String getType(Uri uri) {
        long token = Binder.clearCallingIdentity();
        try { 
            Path path = Path.fromString(uri.getPath());