Stay organized with collections Save and categorize content based on your preferences.

public class LauncherActivityInfo
extends Object



A representation of an activity that can belong to this user or a managed profile associated with this user. It can be used to query the label, icon and badged icon for the activity.

Summary

Public methods

ActivityInfo getActivityInfo()

Returns the ActivityInfo of the activity.

ApplicationInfo getApplicationInfo()

Returns the application info for the application this activity belongs to.

Drawable getBadgedIcon(int density)

Returns the activity icon with badging appropriate for the profile.

ComponentName getComponentName()

Returns the component name of this activity.

long getFirstInstallTime()

Returns the time at which the package was first installed.

Drawable getIcon(int density)

Returns the icon for this activity, without any badging for the profile.

CharSequence getLabel()

Retrieves the label for the activity.

float getLoadingProgress()
String getName()

Returns the name for the activity from android:name in the manifest.

UserHandle getUser()

Returns the user handle of the user profile that this activity belongs to.

Inherited methods

From class java.lang.Object

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(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(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()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Public methods

getActivityInfo

public ActivityInfo getActivityInfo ()

Returns the ActivityInfo of the activity.

Returns
ActivityInfo Activity Info This value cannot be null.

getApplicationInfo

public ApplicationInfo getApplicationInfo ()

Returns the application info for the application this activity belongs to.

Returns
ApplicationInfo

getBadgedIcon

public Drawable getBadgedIcon (int density)

Returns the activity icon with badging appropriate for the profile.

Parameters
density int: Optional density for the icon, or 0 to use the default density. Use DisplayMetrics for DPI values.
Returns
Drawable A badged icon for the activity.

getComponentName

public ComponentName getComponentName ()

Returns the component name of this activity.

Returns
ComponentName ComponentName of the activity

getFirstInstallTime

public long getFirstInstallTime ()

Returns the time at which the package was first installed.

Returns
long The time of installation of the package, in milliseconds.

getIcon

public Drawable getIcon (int density)

Returns the icon for this activity, without any badging for the profile.

Parameters
density int: The preferred density of the icon, zero for default density. Use density DPI values from DisplayMetrics.
Returns
Drawable The drawable associated with the activity.

getLabel

public CharSequence getLabel ()

Retrieves the label for the activity.

Returns
CharSequence The label for the activity.

getLoadingProgress

public float getLoadingProgress ()
Returns
float Package loading progress, range between [0, 1]. Value is between 0.0 and 1.0 inclusive

getName

public String getName ()

Returns the name for the activity from android:name in the manifest.

Returns
String the name from android:name for the activity.

getUser

public UserHandle getUser ()

Returns the user handle of the user profile that this activity belongs to. In order to persist the identity of the profile, do not store the UserHandle. Instead retrieve its serial number from UserManager. You can convert the serial number back to a UserHandle for later use.

Returns
UserHandle The UserHandle of the profile.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2023-02-08 UTC.