Book Title
Android How to Program 2nd Edition


July 17, 2017
A new class of objects can be created quickly and conveniently by ________; the new
class absorbs the characteristics of an existing one, possibly customizing them and
adding unique characteristics of its own.
(True/False) According to the Android design guidelines for dialogs, most dialogs need
(True/False) When an EditText receives the focus, its corresponding soft keyboard is
(True/False) If a list item should display multiple pieces of data, you"ll need a list-item
layout that consists of multiple elements, and each element will need an android:id
(True/False) Some apps dynamically generate GUI components in response to user
interactions. For such GUI components, you can programmatically set the accessibility
(True/False) Resource subfolder names that begin with other contain XML files that do
not fit into the other resource categories. These are often raw XML data files used by
the app.
(True/False) The preferred Andoid integrated development environment of the future is
(True/False) Eclipse automatically digitally signs your app when you execute it in an
emulator or on a device for debugging purposes.
(True/False) Each AsyncTask can be executed many times.
(True/False) Resource subfolder names that begin with color contain XML files that
define a list of colors for various states, such as the states of a Button (unpressed,
pressed, enabled, etc.).
(True/False) Inherited SurfaceView method get Holder returns the SurfaceHolder object
for managing the SurfaceView, and SurfaceHolder method addCallback stores the
object that implements interface SurfaceHolder.Callback.
(True/False) You can define common GUI component attribute"value pairs as
styleresources. You can then apply the styles to all components that share those values
by using the style attribute. Any subsequent changes you make to a style are
automatically applied to all GUI components.
(True/False) When developing apps for distribution, to reach the largest audience, you
should target all Android devices.
(True/False) You can have one or more files containing key"value pairs associated with
each appeach key enables you to quickly look up a corresponding value.
(True/False) Typically, colors are defined in a file named colors.xml, which Android
creates for you.
(True/False) Calling the superclass's onCreate method is required when overriding
(True/False) Alert Dialogs are often created using anonymous inner classes that extend
DialogFragment and display only text and buttons. AlertDialogs may also contain
custom Views.
(True/False) When the user selects a menu item, Fragment method on
OptionsItemSelected responds to the selection.
(True/False) It's considered a good practice to place strings, string arrays, images,
colors, font sizes, dimensions and other app resources in XML files within the
subfolders of the project's res folder, so that the resources can be managed separately
from your app's Java code. This is known as internalizing the resources.
(True/False) A FrameLayout is designed to display many Views.
(True/False) In-app advertising generates significant revenue for most apps.
The Android Support Library is a set of libraries that are commonly used to provide
new Android features for use in older Android versions.
(True/False) To drive additional sales of your apps, you can launch the Play Store app
(Google Play) from within your app (typically by including a button) so that the user
can download other apps you"ve published or purchase a related app with functionality
beyond that of the previously downloaded "lite" version.
(True/False) The Android Developer Tools IDE allows only one project with a given
name per workspace.
(True/False) We override Activity method onCreateOptionsMenu to initialize Activity's
standard options menu.
(True/False) Suppose your app dynamically loads image file names and stores them in
an ArrayList<String>. You can use Collections method randomize to shuffle the order
of the image file names for each new game.
(True/False) Many constants are defined in the Intent class describing actions such as
searching, choosing, sending and playing.
(True/False) To make your app available to potential users, you must upload it to
Google Play.
(True/False) Sound files are stored in the app's res/raw folder.
(True/False) We can use Android's WindowManager to obtain a Display object that
contains the display's current width and height. This changes with the device's
orientationin portrait orientation, the device's height is less than its width.
(True/False) You can use a CursorAdapter (package android-.widget) to display the
results of a database query in a List View.
(True/False) Most ads on Android pay based on the number of impressions generated
rather than the click-through rate (CTR) of the ads.
(True/False) Fragment method onSaveInstanceState executes when the configuration of
the device changes during the app's executionfor example, when the user rotates the
device or slides out a keyboard on a device with a hard keyboard.
(True/False) You set a line's width using Paint's setLineWidth method.
(True/False) You cannot test GPS apps in the emulator.
(True/False) Database names must be unique across apps.
(True/False) You create the AndroidManifest.xml file when you create an app.
(True/False) Resource subfolder names that begin with menu contain XML files that
describe the contents of menus. When you create a project, the IDE automatically
defines a menu with a Settings option.
With Google Play, you have the option to include with your app an ________ (EULA)
an agreement through which you license your software to the user.
Which of the statements in a), b) and c) is true?
a. You can perform a shake animation by applying an Animation to an ImageView.
b. We use AnimationUtils static method load Animation to load the animation from an
XML file that specifies the animation's options.
c. We can specify the number of times an animation should repeat with Animation
method setRepeatCount and perform the animation by calling View method
startAnimation (with the Animation as an argument) on the ImageView.
d. Statements a), b) and c) are all true.
Which of the following statements is false?
a. Each Activity can specify intent filters indicating actions the Activity is capable of
b. Intent filters are defined in the AndroidManifest.xml file.
c. An Intent is used to launch an Activityit indicates an action to be performed and the
data on which to perform that action.
d. An intent is a GUI that shows a list of apps that can handle the specified Intent.
________ is a short-range wireless connectivity standard intended for communication
between two devices within a few centimeters. It can be used for payments, exchanging
data such as contacts and pictures, pairing devices and accessories and more.
a. Wifi
b. Near-field communication (NFC)
c. Bluetooth
Which of the following statements is false?
a. One benefit of developing Android apps is the openness of the platform.
b. The Android operating system is proprietary and free.
c. You can view Android's source code and see how its features are implemented.
d. None of the above is false.
Financial transactions for paid apps in Google Play are handled by Google ________,
though customers of some mobile carriers can opt to use carrier billing to charge paid
apps to their wireless bill.
a. Basket
b. Pouch
c. Wallet
d. Pay
Which package includes user interface classes for layout and user interactions?
a. android.app
b. android.graphics
c. android.media
d. android.view
The Android Development Tools (ADT) Plugin for Eclipse:
a. is part of the Android SDK/ADT Bundle
b. allows you to create, run and debug Android apps, export them for distribution (e.g.,
upload them to Google Play), and more.
c. enables GUI components to be dragged and dropped into place to form GUIs without
any coding.
d. all of the above.
Which of the following statements is false?
a. Immersive mode enables apps to use the entire screen.
b. Colors are defined using the ARGB color scheme in which the alpha (i.e.,
transparency), red, green and blue components are specified by integers in the range
c. For alpha, 0 means completely opaque and 255 means completely transparent.
d. For red, green and blue, 0 means none of that color and 255 means the maximum
amount of that color.
Which of the following statements is false?
a. The onCreate method is called by the system when an Activity is started.
b. Method onCreate typically initializes the Activity's instance variables and views.
c. Method onCreate should perform the bulk of the app's work.
d. In fact, if the app takes longer than five seconds to load, the operating system will
display an ANR (Application Not Responding) dialoggiving the user the option to
forcibly terminate the app.
Which of the following statements is false?
A. Each cell in a GridLayout can be empty or can hold one or more views, including
layouts that contain other views.
b. Views can span multiple rows or columns. You can specify a GridLayout's number of
rows and columns in the Properties window.
c. Each row's height is determined by the tallest view in that row. Similarly, the width of
a column is defined by the tallest view in that column.
d. By default, views are added to a row from left to right. You can specify the exact row
and column in which a view is to be placed.
Which, if any, of the following statements is false?
a. You can reuse a class many times to build many objects.
b. Reuse of existing classes when building new classes and programs saves time and
c. Reuse helps you build more reliable and effective systems, because existing classes
and components often have gone through extensive testing, debugging and performance
d. All of the above are true.
Which of the following statements is false?
a. Text can be displayed in a TextView and pictures can be displayed in ImageViews.
b. You use the Graphical Layout editor's Palette of GUI controls to drag and drop
ImageViews onto the GUI.
c. It's considered good practice to define all strings and numeric values in resource files
that are placed in the subfolders of a project's resources.xml folder.
d. An example of a string resource is the text on a TextView. An example of a
measurements resource is a font's size.
Which of the following statements is(are) false?
a. Fragments describe portions of an app's user interface and can be combined into one
screen or used across multiple screens.
b. The Action Bar at the top of the screen provides users with options for interacting
with apps.
c. The primary reason for using multicore processor architectures is to increase the
amount of memory available to apps.
d. (a) and (c) are false.
An app's sound effects are managed with a ________ (package android.media), which
can be used to load, play and unload sounds.
Which of the following statements is false?
a. A ListActivity's default GUI contains only a ListView that fills the screen's client area
between Android's top and bottom system bars.
b. If a ListActivity's GUI requires only the default ListView, then you need to define a
separate layout for your ListActivity subclass.
c. When customizing a ListActivity subclass's GUI, the layout must contain a ListView
with its Id attribute set to "@android:id/list".
d. "@android:id/list" is the name that class ListActivity uses to reference its ListView.
Which statement about the Android emulator is false?
a. It's included in the Android SDK.
b. It allows you to run Android apps in a simulated environment within Windows, Mac
OS X or Linux, that must be coupled with an actual Android device.
c. It displays a realistic Android user-interface window.
d. It's particularly useful if you do not have access to Android devices for testing.
Which of the following statements is false?
a. For an ImageView there is no text for TalkBack to speak unless you provide it.
b. It's considered a best practice in Android to ensure that every GUI component can be
used with TalkBack by providing text for the Content Description property of any
component that does not display text.
c. The text that you provide should help the user understand the purpose of the
componentfor example, for an ImageView, the text should describe the image.
d. The IDE warns that something is wrong with a GUI by displaying small warning
icons in the Graphical Layout editor next to each ImageView. These warningswhich are
generated by the Java compilerindicate that you did not set the Content Description
property of each image.
Which of the following statements is false?
a. A LinearLayout arranges views either horizontally (the default) or vertically and can
size its views proportionally.
b. GridLayout arranges views into cells in a rectangular grid. Cells can occupy only
one row within a column.
c. In many cases, GridLayout can be used to replace the older, and sometimes less
efficient TableLayout, which arranges views into rows and columns where each row is
typically defined as a TableRow and the number of columns is defined by the TableRow
containing the most cells.
d. A GridLayout cannot specify within a given row that the horizontal space should be
allocated proportionally between multiple views.
Which of the following EditTexts's Input Type property values might be used to ensure
that state abbreviations are displayed in capital letters?
a. textPersonName|textCapWords
b. textPostalAddress|textCapWords
c. textPostalAddress|textCapCharacters
d. number
Immersive mode enables you to:
a. Create apps that detect whether the user is running, walking or climbing stairs.
b. Create SMS (Short Message Service) or MMS (Multimedia Messaging Service) apps
using the new SMS provider and APIs.
c. Record video of your app in action to create tutorials and marketing materials.
d. Hide the status bar at the top of the screen and the menu buttons at the bottom,
allowing your apps to fill more of the screen.
Which of the following statements is false?
a. You create the AndroidManifest.xml file when you create a new app project.
b. The AndroidManifest.xml file contains many of the settings that you specify in the
New Android Application dialog, such as the app's name, package name, target and
minimum SDKs, Activity name(s), theme and more.
c. You can use the IDE's Android Manifest editor to add a new setting to the manifest
that forces the soft keyboard to remain on the screen.
d. You can specify that an app supports only portrait orientationthat is, the device's
longer side is vertical.
Which of the following statements is false?
a. Method onTouchEvent is called when the View receives a touch event.
b. Android supports multitouchthat is, having multiple fingers touching the screen.
c. The user must maintain the same number of fingers touching the screen for the
duration of the multitouch event.
d. Each fingerknown as a pointerhas a unique ID that identifies it across touch events.
Which of the following statements is false?
a. When you build an app for distribution via app stores like Google Play, you should
focus your testing on the particular android device the app is most likely to run on.
b. Some features can be tested only on actual devices.
c. If you don"t have many devices available to you, create AVDs that simulate the
various devices on which you"d like your app to execute.
d. When you configure each AVD to simulate a particular device, look up the device's
specifications online and configure the AVD accordingly.
Which of the following statements is false?
a. Templates provide preconfigured starting points for commonly used app designs.
b. The Blank Activity template is used for a single-screen app in which most of the GUI
is provided by default. Provides an action bar at the top of the app that displays the
app's name and can display controls that enable a user to interact with the app.
c. The Fullscreen Activity template is used for a single-screen app that occupies the
entire screen, but can toggle visibility of the device's status bar and the app's action bar.
d. The Master/Detail Flow template is used for an app that displays a master list of
items from which a user can choose one item to see its detailssimilar to the built-in
Email and People apps. For tablets, the master list and details are shown side-by-side on
the same screen. For phones, the master list is shown on one screen, and selecting an
item displays the item's details in a separate screen.
Which of the following statements about the nested classes in class R is false?
a. class drawable contains constants for any drawable items, such as images, that you
put in the various drawable folders in your app's res folder
b. class view contains constants for the views in your XML layout files
c. class layout contains constants that represent each layout file in your project (such
as, activity_main.xml)
d. class string contains constants for each String in the strings.xml file.
Which of the following statements is false?
a. Bitmap's static createBitmap method creates a Bitmap of the specified width and
b. The last argument to createBitmap is the Bitmap's encoding, which specifies how
each pixel in the Bitmap is stored. The constant Bitmap.Config.ARGB_8888 indicates
that each pixel's color has a default value of 8 for the alpha, red, green and blue
c. A Canvas is used to draw shapes directly to a Bitmap.
d. You can use Bitmap's eraseColor method to fill the Bitmap with white pixels.
Which of the following statements is false?
a. With implicit Intents we allow Android to launch the most appropriate Activity based
on the type of data.
b. If multiple activities can handle the action and data passed to startActivity, the
system will display a dialog in which the user can select which Activity to use.
c. If the system cannot find an Activity to handle the action, then method startActivity
throws an ActivityNotFoundException.
d. Explicit Intents indicate the precise set of activities to choose from.
Your project's res folder contains several subfolders that begin with the name drawable.
These folders store images with different pixel densities. The folder that stores images
with approximately 640 dot-per-inch is ________.
a. drawable-hdpi (high density).
b. drawable-xhdpi (extra high density).
c. drawable-xxhdpi (extra extra high density).
d. drawable-xxxhdpi (extra extra extra high density).
Which of the following statements is false?
a. To display the Cursor's results in a ListView we create a new CursorAdapter object
which exposes the Cursor's data in a manner that can be used by a ListView.
b. SimpleCursorAdapter is a subclass of CursorAdapter that's designed to simplify
mapping Cursor columns directly to TextViews or ImagesViews defined in your XML
c. You must use standard layout resources for ListView items.
d. You call inherited ListActivity method setListAdapter to bind a ListView to a
CursorAdapter, so that the ListView can display the data.
Which of the following statements is false?
a. When an Activity hosts Fragments and the Activity is paused, you must call all of its
Fragments' onPause methods.
b. We override onPause to suspend play in a game so that the game does not continue
executing when the user cannot interact with itthis saves battery power.
c. When an Activity is shut down, its onDestroy method is called, which in turn calls
the onDestroy methods of all the Fragments hosted by the Activity.
d. We can use method onDestroy in a game Fragment to release various game resources
The ? in AdapterView<?> is a ________ in Java generics indicating method
onItemClick can receive an Adapter-View that displays any type of data.
You"ll need a high-resolution icon for use in Google Play. This icon should be
________ pixels.
a. 256 x 256
b. 512 x 512
c. 1024 x 1024
d. 2048 x 2048
Which of the following statements about workspaces is false?
a. A workspace is a collection of projects, and each project is typically an app or a
library that can be shared among apps.
b. Each workspace also has its own settings, such as where various Eclipse subwindows
are displayed.
c. You can have many workspaces and switch between them for different development
d. You could have separate workspaces for Android app development, Java app
development and web app development, each with its own custom settings.
e. All of the above statements are true.
You create the AlertDialog by calling the AlertDialog.Builder's create method and
display the modal dialog by calling AlertDialog's ________ method.
According to the Android design guidelines, ________dp is the recommended space
between the edges of a device's touchable screen area and the app's content; however,
many apps (such as games) use the full screen.
(True/False) The DialogFragment's onCreateDialog method uses an ________ to
configure and create an AlertDialog, then returns it.
You call ListView method ________ to indicate that only one item can be selected at a
Andoid applications are typically programmed in ________.
You"ll implement the ________ interface to respond to the user moving the SeekBar's
The options menu is an object of class Menu. To specify Menu options, you override
Activity's ________ method to add the options to the method's Menu argument.
If you supply a newer version number than the database version currently stored on the
device, the DatabaseOpenHelper's onUpgrade method will be called to ________.
The free ________ toolwhich runs when you build your app in release modeshrinks the
size of your .apk file (the Android app package file that contains your app for
installation) and optimizes and obfuscates the code.
Why would you double click strings.xml in the res/values folder?
Game-development frameworks typically provide sophisticated "________-perfect"
collision-detection capabilities.
Android's full-screen immersive mode enables an app to take advantage of the entire
screen, but still allows the user to access the ________ when necessary.
The last Fragment lifecycle method called when a Fragment is about to be detached
from a parent Activity is ________.
Returning true from onCreateOptionsMenu indicates that ________.
The ________ manages media files (images, audio and video) stored on a device.

Subscribe Now

Sign up to view full document

View Document