Added in API level 1

Builder

class Builder
kotlin.Any
   ↳ android.net.Uri.Builder

Helper class for building or manipulating URI references. Not safe for concurrent use.

An absolute hierarchical URI reference follows the pattern: <scheme>://<authority><absolute path>?<query>#<fragment>

Relative URI references (which are always hierarchical) follow one of two patterns: <relative or absolute path>?<query>#<fragment> or //<authority><absolute path>?<query>#<fragment>

An opaque URI follows this pattern: <scheme>:<opaque part>#<fragment>

Use Uri#buildUpon() to obtain a builder representing an existing URI.

Summary

Public constructors

Constructs a new Builder.

Public methods
Uri.Builder!
appendEncodedPath(newSegment: String!)

Appends the given segment to the path.

Uri.Builder!
appendPath(newSegment: String!)

Encodes the given segment and appends it to the path.

Uri.Builder!

Encodes the key and value and then appends the parameter to the query string.

Uri.Builder!
authority(authority: String!)

Encodes and sets the authority.

Uri!

Constructs a Uri with the current attributes.

Uri.Builder!

Clears the the previously set query.

Uri.Builder!
encodedAuthority(authority: String!)

Sets the previously encoded authority.

Uri.Builder!
encodedFragment(fragment: String!)

Sets the previously encoded fragment.

Uri.Builder!
encodedOpaquePart(opaquePart: String!)

Sets the previously encoded opaque scheme-specific-part.

Uri.Builder!

Sets the previously encoded path.

Uri.Builder!

Sets the previously encoded query.

Uri.Builder!
fragment(fragment: String!)

Encodes and sets the fragment.

Uri.Builder!
opaquePart(opaquePart: String!)

Encodes and sets the given opaque scheme-specific-part.

Uri.Builder!
path(path: String!)

Sets the path.

Uri.Builder!
query(query: String!)

Encodes and sets the query.

Uri.Builder!
scheme(scheme: String!)

Sets the scheme.

String

Public constructors

Builder

Added in API level 1
Builder()

Constructs a new Builder.

Public methods

appendEncodedPath

Added in API level 1
fun appendEncodedPath(newSegment: String!): Uri.Builder!

Appends the given segment to the path.

appendPath

Added in API level 1
fun appendPath(newSegment: String!): Uri.Builder!

Encodes the given segment and appends it to the path.

appendQueryParameter

Added in API level 1
fun appendQueryParameter(
    key: String!,
    value: String!
): Uri.Builder!

Encodes the key and value and then appends the parameter to the query string.

Parameters
key String!: which will be encoded
value String!: which will be encoded

authority

Added in API level 1
fun authority(authority: String!): Uri.Builder!

Encodes and sets the authority.

build

Added in API level 1
fun build(): Uri!

Constructs a Uri with the current attributes.

Exceptions
java.lang.UnsupportedOperationException if the URI is opaque and the scheme is null

clearQuery

Added in API level 11
fun clearQuery(): Uri.Builder!

Clears the the previously set query.

encodedAuthority

Added in API level 1
fun encodedAuthority(authority: String!): Uri.Builder!

Sets the previously encoded authority.

encodedFragment

Added in API level 1
fun encodedFragment(fragment: String!): Uri.Builder!

Sets the previously encoded fragment.

encodedOpaquePart

Added in API level 1
fun encodedOpaquePart(opaquePart: String!): Uri.Builder!

Sets the previously encoded opaque scheme-specific-part.

Parameters
opaquePart String!: encoded opaque part

encodedPath

Added in API level 1
fun encodedPath(path: String!): Uri.Builder!

Sets the previously encoded path.

If the path is not null and doesn't start with a '/', and if you specify a scheme and/or authority, the builder will prepend the given path with a '/'.

encodedQuery

Added in API level 1
fun encodedQuery(query: String!): Uri.Builder!

Sets the previously encoded query.

fragment

Added in API level 1
fun fragment(fragment: String!): Uri.Builder!

Encodes and sets the fragment.

opaquePart

Added in API level 1
fun opaquePart(opaquePart: String!): Uri.Builder!

Encodes and sets the given opaque scheme-specific-part.

Parameters
opaquePart String!: decoded opaque part

path

Added in API level 1
fun path(path: String!): Uri.Builder!

Sets the path. Leaves '/' characters intact but encodes others as necessary.

If the path is not null and doesn't start with a '/', and if you specify a scheme and/or authority, the builder will prepend the given path with a '/'.

query

Added in API level 1
fun query(query: String!): Uri.Builder!

Encodes and sets the query.

scheme

Added in API level 1
fun scheme(scheme: String!): Uri.Builder!

Sets the scheme.

Parameters
scheme String!: name or null if this is a relative Uri

toString

Added in API level 1
fun toString(): String
Return
String a string representation of the object.