2/15/26, 8:48 PM ContentUris | API reference | Android Developers
Content Added in API level 1 (/guide/topics/manifest/uses-sdk-element#ApiLevels)
Uris
Kotlin (/reference/kotlin/android/content/ContentUris) | Java
public class ContentUris
extends Object (/reference/java/lang/Object)
[Link] (/reference/java/lang/Object)
↳ [Link]
Utility methods useful for working with Uri (/reference/android/net/Uri) objects that use the
"content" (content://) scheme.
Content URIs have the syntax
content://authority/path/id
content:
The scheme portion of the URI. This is always set to
ContentResolver.SCHEME_CONTENT
(/reference/android/content/ContentResolver#SCHEME_CONTENT) (value content:// ).
authority
A string that identifies the entire content provider. All the content URIs for the
provider start with this string. To guarantee a unique authority, providers should
consider using an authority that is the same as the provider class' package
identifier.
path
Zero or more segments, separated by a forward slash ( / ), that identify some subset
of the provider's data. Most providers use the path part to identify individual tables.
Individual segments in the path are often called "directories" although they do not
refer to file directories. The right-most segment in a path is often called a "twig"
[Link] 1/7
2/15/26, 8:48 PM ContentUris | API reference | Android Developers
id
A unique numeric identifier for a single row in the subset of data identified by the
preceding path part. Most providers recognize content URIs that contain an id part
and give them special handling. A table that contains a column named _ID often
expects the id part to be a particular value for that column.
Summary
Public constructors
ContentUris (/reference/android/content/ContentUris#ContentUris())()
Public methods
static [Link] appendId
(/reference/android/net/[Link]) (/reference/android/content/ContentUris#appendId([Link]
([Link] (/reference/android/net/[Link]) builder, lo
Appends the given ID to the end of the path.
static long parseId (/reference/android/content/ContentUris#parseId(android
(/reference/android/net/Uri) contentUri)
Converts the last path segment to a long.
static Uri removeId (/reference/android/content/ContentUris#removeId(and
(/reference/android/net/Uri) (/reference/android/net/Uri) contentUri)
Removes any ID from the end of the path.
static Uri withAppendedId
(/reference/android/net/Uri) (/reference/android/content/ContentUris#withAppendedId(android
(Uri (/reference/android/net/Uri) contentUri, long id)
Appends the given ID to the end of the path.
[Link] 2/7
2/15/26, 8:48 PM ContentUris | API reference | Android Developers
Inherited methods
From class [Link] (/reference/java/lang/Object)
Object (/reference/java/lang/Object) clone (/reference/java/lang/Object#clone())()
Creates and returns a copy of this object.
boolean equals
(/reference/java/lang/Object#equals([Link]
(Object (/reference/java/lang/Object) obj)
Indicates whether some other object is "equal to" this
one.
void finalize (/reference/java/lang/Object#finalize())()
Called by the garbage collector on an object when
garbage collection determines that there are no more
references to the object.
final Class (/reference/java/lang/Class)<?> getClass (/reference/java/lang/Object#getClass())()
Returns the runtime class of this Object .
int hashCode (/reference/java/lang/Object#hashCode())
()
Returns a hash code value for the object.
final void notify (/reference/java/lang/Object#notify())()
Wakes up a single thread that is waiting on this
object's monitor.
final void notifyAll (/reference/java/lang/Object#notifyAll())
()
Wakes up all threads that are waiting on this object's
monitor.
String (/reference/java/lang/String) toString (/reference/java/lang/Object#toString())()
Returns a string representation of the object.
[Link] 3/7
2/15/26, 8:48 PM ContentUris | API reference | Android Developers
final void wait (/reference/java/lang/Object#wait(long,%20int))
(long timeoutMillis, int nanos)
Causes the current thread to wait until it is awakened,
typically by being notified or interrupted, or until a
certain amount of real time has elapsed.
final void wait (/reference/java/lang/Object#wait(long))(long
timeoutMillis)
Causes the current thread to wait until it is awakened,
typically by being notified or interrupted, or until a
certain amount of real time has elapsed.
final void wait (/reference/java/lang/Object#wait())()
Causes the current thread to wait until it is awakened,
typically by being notified or interrupted.
Public constructors
ContentUris
public ContentUris ()
Public methods
appendId Added in API level 1 (/guide/topics/manifest/uses-sdk-element#ApiLevels)
public static [Link] (/reference/android/net/[Link]) appendId ([Link] (/ref
long id)
[Link] 4/7
2/15/26, 8:48 PM ContentUris | API reference | Android Developers
Appends the given ID to the end of the path.
Parameters
builder [Link] : to append the ID to.
This value cannot be null .
id long : to append
Returns
[Link] the given builder.
(/reference/android/net/[Link]) This value cannot be null .
parseId Added in API level 1 (/guide/topics/manifest/uses-sdk-element#ApiLevels)
public static long parseId (Uri (/reference/android/net/Uri) contentUri)
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.
Parameters
contentUri Uri : This value cannot be null .
[Link] 5/7
2/15/26, 8:48 PM ContentUris | API reference | Android Developers
Returns
long the long conversion of the last segment or -1 if the path is empty
Throws
NumberFormatException if the last segment isn't a number
(/reference/java/lang/NumberFormatException)
UnsupportedOperationException if this isn't a hierarchical URI
(/reference/java/lang/UnsupportedOperationException)
removeId Added in API level 29 (/guide/topics/manifest/uses-sdk-element#ApiLevels)
public static Uri (/reference/android/net/Uri) removeId (Uri (/reference/android/net/Uri) con
Removes any ID from the end of the path.
Parameters
contentUri Uri : that ends with an ID.
This value cannot be null .
Returns
Uri (/reference/android/net/Uri) a new URI with the ID removed from the end of the path.
This value cannot be null .
[Link] 6/7
2/15/26, 8:48 PM ContentUris | API reference | Android Developers
Throws
IllegalArgumentException when the given URI has no ID to remove from the end
(/reference/java/lang/IllegalArgumentException) of the path
withAppendedId Added in API level 1 (/guide/topics/manifest/uses-sdk-element#ApiLevels)
public static Uri (/reference/android/net/Uri) withAppendedId (Uri (/reference/android/net/U
long id)
Appends the given ID to the end of the path.
Parameters
contentUri Uri : to start with.
This value cannot be null .
id long : to append
Returns
Uri (/reference/android/net/Uri) a new URI with the given ID appended to the end of the path.
This value cannot be null .
Content and code samples on this page are subject to the licenses described in the Content License
(/license). Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2026-02-13 UTC.
[Link] 7/7