Appendix

Answers to Exercises

This appendix includes the answers to the end-of-chapter exercises.

Chapter 1 ANSWERS

  1. An AVD is an Android Virtual Device. It represents an Android emulator, which emulates a particular configuration of an actual Android device.
  2. Because Jelly Bean had the largest install base at the time.
  3. Software Development Kit.

Chapter 2 ANSWERS

  1. The company domain is used to name the Java package to which your code will belong.
  2. This screen adds commonly used features to your project at the time the project is created.
  3. Code completion is an invaluable tool that shows you contextual options for completing the piece of code that you are trying to write.
  4. Breakpoints are mechanisms that enable Android Studio to temporarily pause execution of your code to let you examine the condition of your application.

Chapter 3 ANSWERS

  1. Activity
  2. android:theme
  3. onCreateDialog()
  4. Intents
  5. startActivityForResult()

Chapter 4 ANSWERS

  1. The dp unit is density independent and 1dp is equivalent to one pixel on a 160-dpi screen. The px unit corresponds to an actual pixel on screen. You should always use the dp unit because it enables your activity to scale properly when run on devices of varying screen size.
  2. With the advent of devices with different screen sizes, using AbsoluteLayout makes it difficult for your application to have a consistent look and feel across devices.
  3. The onPause() event is fired whenever an activity is killed or sent to the background. The onSaveInstanceState() ...

Get Beginning Android Programming with Android Studio, Fourth 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.