Uri.parse() Uri.fromParts()

Uri.parse( String uriString) Creates a Uri which parses the given encoded URI string.
Open Declaration Uri.fromParts( String scheme, String ssp, String fragment)
scheme:ssp#fragment (encoded)

Creates an opaque Uri from the given components. Encodes the ssp which means this method cannot be used to create hierarchical URIs.

Parameters:
scheme of the URI
ssp scheme-specific-part, everything between the scheme separator (':') and the fragment separator ('#'), which will get encoded
fragment fragment, everything after the '#', null if undefined, will get encoded
Returns:
Uri composed of the given scheme, ssp, and fragment

 Uri.parse("tel:" + "110");
 Uri.fromParts("tel", "110", null);

 parse: tel:110
 fromParts: tel:110


Uri.parse("tel:" + "110");
Uri.fromParts("tel", "110", "hi");
parse: tel:110
fromParts: tel:110#hi

 Uri.parse("tel:" + "110%%");
 Uri.fromParts("tel", "110%", "hi%");

 parse: tel:110%%
fromParts: tel:110%25#hi%25

你可能感兴趣的:(Uri.parse() Uri.fromParts())