From Big Nerd Ranch Android guide, chs 13-16