Appendix C. Answers to Exercises
This appendix includes the answers to the end of chapter exercises.
CHAPTER 1 ANSWERS
An AVD is an Android Virtual Device. It represents an Android Emulator, which emulates a particular configuration of an actual Android device.
The
android:versionCode
attribute is used to programmatically check if an application can be upgraded. It should contain a running number (an updated application should be set to a higher number than the older version). Theandroid:versionName
attribute is used mainly for displaying to the user. It is a string, such as "1.0.1".The
strings.xml
file is used to store all string constants in your application. This enables you to easily localize your application by simply replacing the strings and then recompiling your application.
CHAPTER 2 ANSWERS
The Android OS will display a dialog from which users can choose which activity they want to use.
Intent i = new Intent(android.content.Intent.ACTION_VIEW, Uri.
parse
("http://www.amazon.com")); startActivity(i);In an intent filter, you can specify the following: action, data, type, and category.
The
Toast
class is used to display alerts to the user and disappears after a few seconds. TheNotificationManager
class is used to display notifications on the device's status bar. The alert displayed by theNotificationManager
class is persistent and can only be dismissed by the user when selected.
CHAPTER 3 ANSWERS
The
dp
unit is density independent and 160dp is equivalent to one inch. Thepx
unit ...
Get Beginning Android™ Application Development 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.