共用方式為


NdefRecord.ToUri Method

Definition

Map this record to a URI, or return null if it cannot be mapped.

[Android.Runtime.Register("toUri", "()Landroid/net/Uri;", "")]
public Android.Net.Uri? ToUri ();
[<Android.Runtime.Register("toUri", "()Landroid/net/Uri;", "")>]
member this.ToUri : unit -> Android.Net.Uri

Returns

Uri

URI, or null if this is not a URI record

Attributes

Remarks

Map this record to a URI, or return null if it cannot be mapped.

Currently this method considers the following to be URI records: <ul> <li>#TNF_ABSOLUTE_URI records.</li> <li>#TNF_WELL_KNOWN with a type of #RTD_URI.</li> <li>#TNF_WELL_KNOWN with a type of #RTD_SMART_POSTER and containing a URI record in the NDEF message nested in the payload. </li> <li>#TNF_EXTERNAL_TYPE records.</li> </ul> If this is not a URI record by the above rules, then null is returned.

This method does not perform validation that the URI is actually valid: it always attempts to create and return a URI if this record appears to be a URI record by the above rules.

The returned URI will be normalized to have a lower case scheme using Uri#normalizeScheme.

Java documentation for android.nfc.NdefRecord.toUri().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to