Share via


ContentUris.ParseId(Uri) Method

Definition

Converts the last path segment to a long.

[Android.Runtime.Register("parseId", "(Landroid/net/Uri;)J", "")]
public static long ParseId (Android.Net.Uri contentUri);
[<Android.Runtime.Register("parseId", "(Landroid/net/Uri;)J", "")>]
static member ParseId : Android.Net.Uri -> int64

Parameters

contentUri
Uri

Returns

the long conversion of the last segment or -1 if the path is empty

Attributes

Exceptions

if this isn't a hierarchical URI

if the last segment isn't a number

Remarks

Converts the last path segment to a long.

This supports a common convention for content URIs where an ID is stored in the last segment.

Java documentation for android.content.ContentUris.parseId(android.net.Uri).

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