Skip to content

Most visited

Recently visited

navigation

Tile

public final class Tile
extends Object implements Parcelable

java.lang.Object
   ↳ android.service.quicksettings.Tile


A Tile holds the state of a tile that will be displayed in Quick Settings. A tile in Quick Settings exists as an icon with an accompanied label. It also may have content description for accessibility usability. The style and layout of the tile may change to match a given device.

Summary

Constants

int STATE_ACTIVE

This represents a tile that is currently active.

int STATE_INACTIVE

This represents a tile that is currently in a disabled state but is still interactable.

int STATE_UNAVAILABLE

An unavailable state indicates that for some reason this tile is not currently available to the user for some reason, and will have no click action.

Inherited constants

From interface android.os.Parcelable

Fields

public static final Creator<Tile> CREATOR

Public methods

int describeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

CharSequence getContentDescription()

Gets the current content description for the tile.

Icon getIcon()

Gets the current icon for the tile.

CharSequence getLabel()

Gets the current label for the tile.

int getState()

The current state of the tile.

void setContentDescription(CharSequence contentDescription)

Sets the current content description for the tile.

void setIcon(Icon icon)

Sets the current icon for the tile.

void setLabel(CharSequence label)

Sets the current label for the tile.

void setState(int state)

Sets the current state for the tile.

void updateTile()

Pushes the state of the Tile to Quick Settings to be displayed.

void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

From class java.lang.Object
From interface android.os.Parcelable

Constants

STATE_ACTIVE

added in API level 24
int STATE_ACTIVE

This represents a tile that is currently active. (e.g. wifi is connected, bluetooth is on, cast is casting). This is the default state.

Constant Value: 2 (0x00000002)

STATE_INACTIVE

added in API level 24
int STATE_INACTIVE

This represents a tile that is currently in a disabled state but is still interactable. A disabled state indicates that the tile is not currently active (e.g. wifi disconnected or bluetooth disabled), but is still interactable by the user to modify this state. Tiles that have boolean states should use this to represent one of their states. The tile's icon will be tinted differently to reflect this state, but still be distinct from unavailable.

Constant Value: 1 (0x00000001)

STATE_UNAVAILABLE

added in API level 24
int STATE_UNAVAILABLE

An unavailable state indicates that for some reason this tile is not currently available to the user for some reason, and will have no click action. The tile's icon will be tinted differently to reflect this state.

Constant Value: 0 (0x00000000)

Fields

CREATOR

added in API level 24
Creator<Tile> CREATOR

Public methods

describeContents

added in API level 24
int describeContents ()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(Parcel, int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.

getContentDescription

added in API level 24
CharSequence getContentDescription ()

Gets the current content description for the tile.

Returns
CharSequence

getIcon

added in API level 24
Icon getIcon ()

Gets the current icon for the tile.

Returns
Icon

getLabel

added in API level 24
CharSequence getLabel ()

Gets the current label for the tile.

Returns
CharSequence

getState

added in API level 24
int getState ()

The current state of the tile.

Returns
int

See also:

setContentDescription

added in API level 24
void setContentDescription (CharSequence contentDescription)

Sets the current content description for the tile. Does not take effect until updateTile() is called.

Parameters
contentDescription CharSequence: New content description to use.

setIcon

added in API level 24
void setIcon (Icon icon)

Sets the current icon for the tile. This icon is expected to be white on alpha, and may be tinted by the system to match it's theme. Does not take effect until updateTile() is called.

Parameters
icon Icon: New icon to show.

setLabel

added in API level 24
void setLabel (CharSequence label)

Sets the current label for the tile. Does not take effect until updateTile() is called.

Parameters
label CharSequence: New label to show.

setState

added in API level 24
void setState (int state)

Sets the current state for the tile. Does not take effect until updateTile() is called.

Parameters
state int: One of STATE_UNAVAILABLE, STATE_INACTIVE, STATE_ACTIVE

updateTile

added in API level 24
void updateTile ()

Pushes the state of the Tile to Quick Settings to be displayed.

writeToParcel

added in API level 24
void writeToParcel (Parcel dest, 
                int flags)

Flatten this object in to a Parcel.

Parameters
dest Parcel: The Parcel in which the object should be written.

flags int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)