java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.view.ContextThemeWrapper
         ↳ android.app.Activity
           ↳ greendroid.app.GDActivity
             ↳ greendroid.app.GDExpandableListActivity

Class Overview

A GDActivity equivalent to ExpandableListActivity that manages an ExpandableListView.

Summary

[Expand]
Inherited Constants
From class android.app.Activity
From class android.content.Context
From interface greendroid.app.ActionBarActivity
Public Constructors
GDExpandableListActivity()
GDExpandableListActivity(ActionBar.Type actionBarType)
Public Methods
int createLayout()
Returns the identifier of the layout that needs to be created for this ActionBarActivity
ExpandableListAdapter getExpandableListAdapter()
Get the ExpandableListAdapter associated with this activity's ExpandableListView.
ExpandableListView getExpandableListView()
Get the activity's expandable list view widget.
long getSelectedId()
Gets the ID of the currently selected group or child.
long getSelectedPosition()
Gets the position (in packed position representation) of the currently selected group or child.
boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id)
Override this for receiving callbacks when a child has been clicked.
void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo)
Override this to populate the context menu when an item is long pressed.
void onGroupCollapse(int groupPosition)
Override this for receiving callbacks when a group has been collapsed.
void onGroupExpand(int groupPosition)
Override this for receiving callbacks when a group has been expanded.
void onPostContentChanged()
Called at the end of the onContentChanged() method.
void onPreContentChanged()
Called at the beginning of the onContentChanged() method.
void setActionBarContentView(View view)

Set the activity content to an explicit view.

void setActionBarContentView(View view, ViewGroup.LayoutParams params)

Set the activity content to an explicit view.

void setActionBarContentView(int resID)

Set the activity content from a layout resource.

void setListAdapter(ExpandableListAdapter adapter)
Provide the adapter for the expandable list.
boolean setSelectedChild(int groupPosition, int childPosition, boolean shouldExpandGroup)
Sets the selection to the specified child.
void setSelectedGroup(int groupPosition)
Sets the selection to the specified group.
Protected Methods
boolean verifyLayout()
Verify the given layout contains everything needed by this Activity.
[Expand]
Inherited Methods
From class greendroid.app.GDActivity
From class android.app.Activity
From class android.view.ContextThemeWrapper
From class android.content.ContextWrapper
From class android.content.Context
From class java.lang.Object
From interface android.content.ComponentCallbacks
From interface android.view.KeyEvent.Callback
From interface android.view.LayoutInflater.Factory
From interface android.view.View.OnCreateContextMenuListener
From interface android.view.Window.Callback
From interface android.widget.ExpandableListView.OnChildClickListener
From interface android.widget.ExpandableListView.OnGroupCollapseListener
From interface android.widget.ExpandableListView.OnGroupExpandListener
From interface greendroid.app.ActionBarActivity

Public Constructors

public GDExpandableListActivity ()

public GDExpandableListActivity (ActionBar.Type actionBarType)

Public Methods

public int createLayout ()

Returns the identifier of the layout that needs to be created for this ActionBarActivity

Returns
  • The layout identifier of the layout to create

public ExpandableListAdapter getExpandableListAdapter ()

Get the ExpandableListAdapter associated with this activity's ExpandableListView.

public ExpandableListView getExpandableListView ()

Get the activity's expandable list view widget. This can be used to get the selection, set the selection, and many other useful functions.

See Also
  • ExpandableListView

public long getSelectedId ()

Gets the ID of the currently selected group or child.

Returns
  • The ID of the currently selected group or child.

public long getSelectedPosition ()

Gets the position (in packed position representation) of the currently selected group or child. Use ExpandableListView#getPackedPositionType, ExpandableListView#getPackedPositionGroup, and ExpandableListView#getPackedPositionChild to unpack the returned packed position.

Returns
  • A packed position representation containing the currently selected group or child's position and type.

public boolean onChildClick (ExpandableListView parent, View v, int groupPosition, int childPosition, long id)

Override this for receiving callbacks when a child has been clicked.

public void onCreateContextMenu (ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo)

Override this to populate the context menu when an item is long pressed. menuInfo will contain an android.widget.ExpandableListView.ExpandableListContextMenuInfo whose packedPosition is a packed position that should be used with ExpandableListView#getPackedPositionType(long) and the other similar methods.

public void onGroupCollapse (int groupPosition)

Override this for receiving callbacks when a group has been collapsed.

public void onGroupExpand (int groupPosition)

Override this for receiving callbacks when a group has been expanded.

public void onPostContentChanged ()

Called at the end of the onContentChanged() method. This may be use to initialize the content of the layout (titles, etc.)

public void onPreContentChanged ()

Called at the beginning of the onContentChanged() method. This may be used to initialize all references on elements.

public void setActionBarContentView (View view)

Set the activity content to an explicit view. This view is placed directly into the activity's view hierarchy. It can itself be a complex view hierarchy.

This method is an equivalent to setContentView(View) that automatically wraps the given layout in an ActionBarHost if needed.

Parameters
view The desired content to display.

public void setActionBarContentView (View view, ViewGroup.LayoutParams params)

Set the activity content to an explicit view. This view is placed directly into the activity's view hierarchy. It can itself be a complex view hierarchy.

This method is an equivalent to setContentView(View, LayoutParams) that automatically wraps the given layout in an ActionBarHost if needed.

Parameters
view The desired content to display.
params Layout parameters for the view.

public void setActionBarContentView (int resID)

Set the activity content from a layout resource. The resource will be inflated, adding all top-level views to the activity.

This method is an equivalent to setContentView(int) that automatically wraps the given layout in an ActionBarHost if needed..

Parameters
resID Resource ID to be inflated.

public void setListAdapter (ExpandableListAdapter adapter)

Provide the adapter for the expandable list.

public boolean setSelectedChild (int groupPosition, int childPosition, boolean shouldExpandGroup)

Sets the selection to the specified child. If the child is in a collapsed group, the group will only be expanded and child subsequently selected if shouldExpandGroup is set to true, otherwise the method will return false.

Parameters
groupPosition The position of the group that contains the child.
childPosition The position of the child within the group.
shouldExpandGroup Whether the child's group should be expanded if it is collapsed.
Returns
  • Whether the selection was successfully set on the child.

public void setSelectedGroup (int groupPosition)

Sets the selection to the specified group.

Parameters
groupPosition The position of the group that should be selected.

Protected Methods

protected boolean verifyLayout ()

Verify the given layout contains everything needed by this Activity. A GDActivity, for instance, manages an ActionBarHost. As a result this method will return true of the current layout contains such a widget.

Returns
  • true if the current layout fits to the current Activity widgets requirements