org.hermit.android.core
Class HelpActivity

java.lang.Object
  extended by Activity
      extended by org.hermit.android.core.HelpActivity

public class HelpActivity
extends Activity

An activity which displays an application's help, in a structured format. Help is supplied via resources arrays; one array contains the titles of the help sections, one contains the texts for each section. Sub-sections can be added.

To use: subclass this activity, and have the subclass call addHelpFromArrays(int, int). Then start this activity when you need to display help.

It is recommended that you configure this activity to handle orientation and keyboardHidden configuration changes in your app manifest.


Constructor Summary
HelpActivity()
           
 
Method Summary
protected  void addHelpFromArrays(int titlesId, int textsId)
          Add help to this help activity.
 void onCreate(Bundle icicle)
          Called when the activity is starting.
protected  void onRestoreInstanceState(Bundle inState)
          This method is called after onStart() when the activity is being re-initialized from a previously saved state, given here in state.
 void onSaveInstanceState(Bundle outState)
          Called to retrieve per-instance state from an activity before being killed so that the state can be restored in onCreate(Bundle) or onRestoreInstanceState(Bundle) (the Bundle populated by this method will be passed to both).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HelpActivity

public HelpActivity()
Method Detail

onCreate

public void onCreate(Bundle icicle)
Called when the activity is starting. This is where most initialization should go: calling setContentView(int) to inflate the activity's UI, etc.

Parameters:
icicle - Saved application state, if any.

onRestoreInstanceState

protected void onRestoreInstanceState(Bundle inState)
This method is called after onStart() when the activity is being re-initialized from a previously saved state, given here in state. Most implementations will simply use onCreate(Bundle) to restore their state, but it is sometimes convenient to do it here after all of the initialization has been done or to allow subclasses to decide whether to use your default implementation. The default implementation of this method performs a restore of any view state that had previously been frozen by onSaveInstanceState(Bundle). This method is called between onStart() and onPostCreate(Bundle).

Parameters:
inState - The data most recently supplied in onSaveInstanceState(Bundle).

onSaveInstanceState

public void onSaveInstanceState(Bundle outState)
Called to retrieve per-instance state from an activity before being killed so that the state can be restored in onCreate(Bundle) or onRestoreInstanceState(Bundle) (the Bundle populated by this method will be passed to both). If called, this method will occur before onStop(). There are no guarantees about whether it will occur before or after onPause().

Parameters:
outState - A Bundle in which to place any state information you wish to save.

addHelpFromArrays

protected void addHelpFromArrays(int titlesId,
                                 int textsId)
Add help to this help activity.

The parameters are the resource IDs of two arrays; the first contains the titles of the help sections, the second contains the bodies of the sections. The arrays must be the same length.

A title and the corresponding content may both be resource IDs of further arrays. These arrays will be added as sub-sections in the most recently-added section. There must be an enclosing outer section.

If this method is called more than once, help will be added to the top level. (This isn't really recommended.)

Parameters:
titlesId - Resource ID of the titles array.
textsId - Resource ID of the contents array.