AI-generated Key Takeaways
-
The
Cardclass is deprecated since API level XE21 and will be removed in a future release. -
Use the
CardBuilderclass to create Glass-styled card layouts instead of theCardclass. -
The
Cardclass was intended as aViewbuilder, not a data model object, so getter methods for attributes are being removed. -
The
addImagemethods allow adding images to a card using Bitmaps, Drawables, or resource IDs. -
You can set the footnote, main text, and timestamp for a card using the corresponding
setmethods.
Card
This class was deprecated
in API level XE21.
Use CardBuilder to build Glass-styled card layouts. This class will be
removed in a future release.
| Nested Classes | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| enum | Card.ImageLayout |
This enum was deprecated
in API level XE21.
Use CardBuilder.Layout to specify how the
card's content should be laid out.
|
|||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
Card(Context context)
This constructor was deprecated
in API level XE21.
Use
CardBuilder(Context, Layout) to specify how the card's
content should be laid out.
|
|||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Card | |||||||||||
| Card | |||||||||||
| Card |
addImage(int imageId)
|
||||||||||
| CharSequence |
getFootnote()
This method was deprecated
in API level XE21.
The
Card class (and its replacement, CardBuilder) are intended to
act as a View builder, not a data model object. The get* methods for
these attributes will no longer be available after the Card class is removed.
|
||||||||||
| Drawable |
getImage(int n)
This method was deprecated
in API level XE21.
The
Card class (and its replacement, CardBuilder) are intended to
act as a View builder, not a data model object. The get* methods for
these attributes will no longer be available after the Card class is removed.
|
||||||||||
| int |
getImageCount()
This method was deprecated
in API level XE21.
The
Card class (and its replacement, CardBuilder) are intended to
act as a View builder, not a data model object. The get* methods for
these attributes will no longer be available after the Card class is removed.
|
||||||||||
| Card.ImageLayout |
getImageLayout()
This method was deprecated
in API level XE21.
Use
CardBuilder.Layout to specify how the
card's content should be laid out.
|
||||||||||
| CharSequence |
getText()
This method was deprecated
in API level XE21.
The
Card class (and its replacement, CardBuilder) are intended to
act as a View builder, not a data model object. The get* methods for
these attributes will no longer be available after the Card class is removed.
|
||||||||||
| CharSequence |
getTimestamp()
This method was deprecated
in API level XE21.
The
Card class (and its replacement, CardBuilder) are intended to
act as a View builder, not a data model object. The get* methods for
these attributes will no longer be available after the Card class is removed.
|
||||||||||
| Card |
setFootnote(CharSequence footnote)
|
||||||||||
| Card |
setFootnote(int footnoteId)
|
||||||||||
| Card |
setImageLayout(Card.ImageLayout imageLayout)
This method was deprecated
in API level XE21.
Use
CardBuilder.Layout to specify how the
card's content should be laid out.
|
||||||||||
| Card |
setText(int textId)
|
||||||||||
| Card |
setText(CharSequence text)
|
||||||||||
| Card |
setTimestamp(int timestampId)
|
||||||||||
| Card |
setTimestamp(CharSequence timestamp)
|
||||||||||
| Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Public Constructors
public Card (Context context)
This constructor was deprecated
in API level XE21.
Use CardBuilder(Context, Layout) to specify how the card's
content should be laid out.
Public Methods
public Card addImage (Bitmap imageBitmap)
Adds an image, specified as a Bitmap, to the card.
Parameters
| imageBitmap | the Bitmap image to add |
|---|
Returns
- this object for call chaining
public Card addImage (Drawable imageDrawable)
Adds an image, specified as a Drawable, to the card.
This method only applies to cards that are converted into views using getView().
RemoteViews built by CardBuilder only support Bitmap and
resource-based images. Drawable images on RemoteViews are not supported.
Parameters
| imageDrawable | the Drawable image to add |
|---|
Returns
- this object for call chaining
public Card addImage (int imageId)
Adds an image, specified as a drawable resource, to the card.
Parameters
| imageId | the resource ID of the image to add |
|---|
Returns
- this object for call chaining
public CharSequence getFootnote ()
This method was deprecated
in API level XE21.
The Card class (and its replacement, CardBuilder) are intended to
act as a View builder, not a data model object. The get* methods for
these attributes will no longer be available after the Card class is removed.
Returns the footnote text for the card.
public Drawable getImage (int n)
This method was deprecated
in API level XE21.
The Card class (and its replacement, CardBuilder) are intended to
act as a View builder, not a data model object. The get* methods for
these attributes will no longer be available after the Card class is removed.
Returns the n-th image associated with the card, where
0 <= n < getImageCount().
Returns
- the
Drawablerepresentation of the n-th image
public int getImageCount ()
This method was deprecated
in API level XE21.
The Card class (and its replacement, CardBuilder) are intended to
act as a View builder, not a data model object. The get* methods for
these attributes will no longer be available after the Card class is removed.
Returns the number of images associated with the card.
public Card.ImageLayout getImageLayout ()
This method was deprecated
in API level XE21.
Use CardBuilder.Layout to specify how the
card's content should be laid out.
Returns the image layout for card.
public CharSequence getText ()
This method was deprecated
in API level XE21.
The Card class (and its replacement, CardBuilder) are intended to
act as a View builder, not a data model object. The get* methods for
these attributes will no longer be available after the Card class is removed.
Returns the main text for the card.
public CharSequence getTimestamp ()
This method was deprecated
in API level XE21.
The Card class (and its replacement, CardBuilder) are intended to
act as a View builder, not a data model object. The get* methods for
these attributes will no longer be available after the Card class is removed.
Returns the timestamp text for the card.
public Card setFootnote (CharSequence footnote)
Sets the footnote text for the card.
Parameters
| footnote | the footnote text for this card |
|---|
Returns
- this object for call chaining
public Card setFootnote (int footnoteId)
Sets the footnote text for the card using a string resource.
Parameters
| footnoteId | the footnote text resource ID for this card |
|---|
Returns
- this object for call chaining
public Card setImageLayout (Card.ImageLayout imageLayout)
This method was deprecated
in API level XE21.
Use CardBuilder.Layout to specify how the
card's content should be laid out.
Sets the image layout for the card.
Parameters
| imageLayout | defines desired image layout |
|---|
Returns
- this object for call chaining
public Card setText (int textId)
Sets the main text for the card using a string resource.
Parameters
| textId | main text resource ID for this card |
|---|
Returns
- this object for call chaining
public Card setText (CharSequence text)
Sets the main text for the card.
Parameters
| text | main text for this card |
|---|
Returns
- this object for call chaining
public Card setTimestamp (int timestampId)
Sets the timestamp text for the card using a string resource.
Parameters
| timestampId | the timestamp text resource ID for this card |
|---|
Returns
- this object for call chaining
public Card setTimestamp (CharSequence timestamp)
Sets the timestamp text for the card.
Parameters
| timestamp | the timestamp text for this card |
|---|
Returns
- this object for call chaining