Android patterns

Archived

This page has been archived and will receive no further updates.

Activities

  • ListActivity
    • Mostly deprecated; use a ListFragment instead (see below)

Content providers

  • Provides an interface for providing content that can be used by other applications or activities within the same application
  • Clients access a content provider using ContentResolver
  • Asynchronously queried using a CursorLoader

Fragments

  • To use ListFragment with CursorLoader and ActionBarActivity:
    • Have the fragment itself (not the activity) implement LoaderManager.LoaderCallbacks and override the requisite methods
    • Set the list adapter in onCreateView in the fragment class
    • For more information, see: