Hello, Android: Introducing Google’s Mobile Development Platform, 3rd Edition

Hello, Android. Introducing Google’s. Mobile Development Platform, 3rd … Let’s start by taking a look at the overall system architecture the key layers and components that make up the Android open source software stack.

More PDF Content

Some of the most important native libraries include the following: Surface Manager: Android uses a compositing window managersimilar to Vista or Compiz, but it\’s much simpler. 264), H. Native development is beyond the scope ofthis book, but if you\’re interested, you can read all about it online. com/sdk/ndkCLICK HERE to purchase this book now. jar files. End users will see only these programs, blissfully unaware of all theaction going on below the waterline. When someone buys an Android phone, it will come prepackaged witha number of standard system applications, including the following:* Phone dialer* EmailCLICK HERE to purchase this book now. From that application, the user might invoke another appli-cation, or another screen in the same application, and then another andanother. Usually you won\’t need to override it becausethe default implementation saves the state for all your user inter-face controls automatically. The default implementation restores thestate of your user interface.
You override these methods in your Activity class, and Android will call them at the appropriate time:

  • onCreate(Bundle): This is called when the activity first starts up. You can use it to perform one-time initialization such as creating CLICK HERE to purchase this book now. Figure 2.3: Life cycle of an Android activity the user interface. onCreate() takes one parameter that is either null or some state information previously saved by the onSaveIn-stanceState( ) method.
  • onStart( ): This indicates the activity is about to be displayed to the user.
  • onResume( ): This is called when your activity can start interacting with the user. This is a good place to start animations and music.
  • onPause( ): This runs when the activity is about to go into the background, usually because another activity has been launched in front of it. This is where you should save your program’s persistent state, such as a database record being edited.
  • onStop(): This is called when your activity is no longer visible to the user and it won’t be needed for a while. If memory is tight, onStop() may never be called (the system may simply terminate your process). Flipping the Lid Here’s a quick way to test that your state-saving code is working correctly. In current versions of Android, an orientation change (between portrait and landscape modes) will cause the system to go through the process of saving instance state, pausing, stopping, destroying, and then creating a new instance of the activity with the saved state. On the T-Mobile G1 phone, for example, flipping the lid on the keyboard will trigger this, and on the Android emulator, pressing Ctrl+F11 or the 7 or 9 key on the keypad will do it.
  • onRestart(): If this method is called, it indicates your activity is being redisplayed to the user from a stopped state.
  • onDestroy( ): This is called right before your activity is destroyed. If memory is tight, onDestroy() may never be called (the system may simply terminate your process).
  • onSaveInstanceState(Bundle): Android will call this method to allow the activity to save per-instance state, such as a cursor position within a text field. Usually you won’t need to override it because the default implementation saves the state for all your user interface controls automatically.
  • onRestoreInstanceState(Bundle): This is called when the activity is being reinitialized from a state previously saved by the onSave-InstanceState() method. The default implementation restores the state of your user interface

 

Download Hello, Android: Introducing Google's Mobile Development Platform, 3rd Edition pdf from media.pragprog.com, 12 pages, 357.41KB.
Related Books

One Response to “Hello, Android: Introducing Google’s Mobile Development Platform, 3rd Edition”

  1. It’s actually a cool and helpful piece of information. I’m satisfied that you shared this useful info with us. Please keep us informed like this. Thank you for sharing.

Leave a Reply