Chapter 1. Activities

This chapter covers the following recipes:

  • Declaring an activity
  • Starting a new activity with an intent object
  • Switching between activities
  • Passing data to another activity
  • Returning a result from an activity
  • Saving an activity's state
  • Storing persistent activity data
  • Understanding the activity lifecycle

Introduction

The Android SDK provides a powerful tool to program mobile devices, and the best way to master such a tool is to jump right in. Though you can read this book from beginning to end, as it is a cookbook, it is specifically designed to allow you to jump to specific tasks and get the results immediately.

Activities are the fundamental building block of most Android applications as the activity class provides the interface ...

Get Android Application Development Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.