Google is committed to advancing racial equity for Black communities. See how.

LocusIdCompat

public final class LocusIdCompat
extends Object

java.lang.Object
   ↳ androidx.core.content.LocusIdCompat


An identifier for an unique state (locus) in the application. Should be stable across reboots and backup / restore.

Locus is a new concept introduced on Android Q and it lets the Android system correlate state between different subsystems such as content capture, shortcuts, and notifications.

For example, if your app provides an activiy representing a chat between 2 users (say A and B, this chat state could be represented by:


 LocusIdCompat chatId = new LocusIdCompat("Chat_A_B");
 

And then you should use that chatId by:

Summary

Public constructors

LocusIdCompat(String id)

Construct a new LocusIdCompat with the specified id.

Public methods

boolean equals(Object obj)
String getId()

Gets the canonical id associated with the locus.

int hashCode()
LocusId toLocusId()
static LocusIdCompat toLocusIdCompat(LocusId locusId)

Returns an instance of LocusIdCompat from given LocusId.

String toString()

Inherited methods

Public constructors

LocusIdCompat

public LocusIdCompat (String id)

Construct a new LocusIdCompat with the specified id.

Parameters
id String

Throws
IllegalArgumentException if id is empty or null.

Public methods

equals

public boolean equals (Object obj)

Parameters
obj Object

Returns
boolean

getId

public String getId ()

Gets the canonical id associated with the locus.

Returns
String

hashCode

public int hashCode ()

Returns
int

toLocusId

public LocusId toLocusId ()

Returns
LocusId LocusId object from this compat object.

toLocusIdCompat

public static LocusIdCompat toLocusIdCompat (LocusId locusId)

Returns an instance of LocusIdCompat from given LocusId.

Parameters
locusId LocusId

Returns
LocusIdCompat

toString

public String toString ()

Returns
String