public abstract class

Item

extends Object
java.lang.Object
   ↳ greendroid.widget.item.Item
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Base class for all items used in GreenDroid. An item represents a wrapper of data. Each item contains at least all the information needed to display a single row in a ListView.

Summary

Fields
public boolean enabled Set to true when this item is enabled
Public Constructors
Item()
Create a new item.
Public Methods
Object getTag()
Return the tag associated to that item.
Object getTag(int key)
Return the tag associated with this item and the specified key.
void inflate(Resources r, XmlPullParser parser, AttributeSet attrs)
Inflate this Item from an XML resource.
abstract ItemView newView(Context context, ViewGroup parent)
Return a view that is associated to the current item.
void setTag(int key, Object tag)
Set a tag associated with this item and a key.
void setTag(Object tag)
Set the tag associated with this item.
Protected Methods
static ItemView createCellFromXml(Context context, int layoutID, ViewGroup parent)
Helper method to inflate a layout using a given Context and a layoutID.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

public boolean enabled

Set to true when this item is enabled

Public Constructors

public Item ()

Create a new item.

Public Methods

public Object getTag ()

Return the tag associated to that item.

Returns
  • The tag associated to this item.

public Object getTag (int key)

Return the tag associated with this item and the specified key.

Parameters
key The key of the tag to retrieve
Returns
  • The tag associated to the key key or null if no tags are associated to that key

public void inflate (Resources r, XmlPullParser parser, AttributeSet attrs)

Inflate this Item from an XML resource.

Throws
XmlPullParserException
IOException
XmlPullParserException

public abstract ItemView newView (Context context, ViewGroup parent)

Return a view that is associated to the current item. The returned view is normally capable of being a good recipient for all item's information.

Parameters
context The Context in which the ItemView will be used
parent The parent View of that new View. The parent is usually the parent ListView and may be used to retrieve the correct LayoutParams type.
Returns
  • A new allocated view for the current Item

public void setTag (int key, Object tag)

Set a tag associated with this item and a key. A tag is often used to store extra information.

Parameters
key The key for the specified tag
tag A tag that will be associated to that item

public void setTag (Object tag)

Set the tag associated with this item. A tag is often used to store extra information.

Parameters
tag The tag associated to this item

Protected Methods

protected static ItemView createCellFromXml (Context context, int layoutID, ViewGroup parent)

Helper method to inflate a layout using a given Context and a layoutID.

Parameters
context The current context
layoutID The identifier of the layout to inflate
Returns
  • A newly inflated view