Deck 6: Managing the Device Orientation

Full screen (f)
exit full mode
Question
The orientation instance variable of the Configuration class represents the ____________ of the device.
Use Space or
up arrow
down arrow
to flip the card.
Question
Which instance variable of the Configuration class stores the width of the device in dp units?

A) width
B) screenWidth
C) screenWidthDp
D) widthDp
Question
We set the android:configChanges attribute of the activity element in the AndroidManifest.xml file if we want to get notified of ____________.
Question
Assuming the AndroidManifest.xml is correct, the onConfigurationChanged method of the Activity class is automatically called when we rotate the device.
Question
It is possible to have one XML file for a horizontal layout and another XML file for a vertical layout.
Question
Assume that h is the height of the screen; we want to have x buttons on the screen all equidistant from each other; the height of each button is b. What is the distance between two buttons?

A) b
B) h/x
C) ( h - x * b )/x
D) ( h - x * b )/( x + 1 )
Question
The ViewGroup.LayoutParameters class contains a setMargins method that allows us to set all four margins.
Question
The XML attribute for the left margin of a GUI component is ____________.
Question
It is possible to define the GUI programmatically for both horizontal and vertical orientations.
Question
Assume that h is the height of the screen; we want to have 5 buttons on the screen all equidistant from each other; the height of each button is b. What is the distance between two buttons?

A) b
B) h/5
C) ( h - 5 * b )/5
D) ( h - 5 * b )/6
Question
The resolveAttribute method of the ____________ class checks whether an attribute is present in a theme.
Question
How do we retrieve the data stored in a TypeValue named tv?

A) data
B) tv.data
C) tv.tvData( )
D) tv.type
Question
The following instance variable of the Configuration class stores the height of the device in dp units, not including the status bar.

A) height
B) screenHeight
C) screenHeightDp
D) heightDp
Question
The parameter of onConfigurationChanged allows us to retrieve the orientation of the device.
Question
When we retrieve and modify the ViewGroup.MarginLayoutParams of a View, for example by calling the setMargins method, we actually modify the layout parameters of that View.
Question
It is possible to retrieve the height of the action bar programmatically.
Question
The constant of the Configuration class whose value is an integer that represents a horizontal orientation is __________________.
Question
The getConfiguration method from the Resources class returns a __________________ reference.
Question
The getResources method from the Context class returns a __________________ reference.
Question
The XML attribute for the right margin of a GUI component is __________________.
Question
The XML attribute for the bottom margin of a GUI component is __________________.
Question
The getDimensionPixelSize method of the Resources class returns the number of __________________ of a resource given its id.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/22
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 6: Managing the Device Orientation
1
The orientation instance variable of the Configuration class represents the ____________ of the device.
orientation
2
Which instance variable of the Configuration class stores the width of the device in dp units?

A) width
B) screenWidth
C) screenWidthDp
D) widthDp
screenWidthDp
3
We set the android:configChanges attribute of the activity element in the AndroidManifest.xml file if we want to get notified of ____________.
orientation changes
4
Assuming the AndroidManifest.xml is correct, the onConfigurationChanged method of the Activity class is automatically called when we rotate the device.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
5
It is possible to have one XML file for a horizontal layout and another XML file for a vertical layout.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
6
Assume that h is the height of the screen; we want to have x buttons on the screen all equidistant from each other; the height of each button is b. What is the distance between two buttons?

A) b
B) h/x
C) ( h - x * b )/x
D) ( h - x * b )/( x + 1 )
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
7
The ViewGroup.LayoutParameters class contains a setMargins method that allows us to set all four margins.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
8
The XML attribute for the left margin of a GUI component is ____________.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
9
It is possible to define the GUI programmatically for both horizontal and vertical orientations.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
10
Assume that h is the height of the screen; we want to have 5 buttons on the screen all equidistant from each other; the height of each button is b. What is the distance between two buttons?

A) b
B) h/5
C) ( h - 5 * b )/5
D) ( h - 5 * b )/6
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
11
The resolveAttribute method of the ____________ class checks whether an attribute is present in a theme.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
12
How do we retrieve the data stored in a TypeValue named tv?

A) data
B) tv.data
C) tv.tvData( )
D) tv.type
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
13
The following instance variable of the Configuration class stores the height of the device in dp units, not including the status bar.

A) height
B) screenHeight
C) screenHeightDp
D) heightDp
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
14
The parameter of onConfigurationChanged allows us to retrieve the orientation of the device.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
15
When we retrieve and modify the ViewGroup.MarginLayoutParams of a View, for example by calling the setMargins method, we actually modify the layout parameters of that View.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
16
It is possible to retrieve the height of the action bar programmatically.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
17
The constant of the Configuration class whose value is an integer that represents a horizontal orientation is __________________.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
18
The getConfiguration method from the Resources class returns a __________________ reference.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
19
The getResources method from the Context class returns a __________________ reference.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
20
The XML attribute for the right margin of a GUI component is __________________.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
21
The XML attribute for the bottom margin of a GUI component is __________________.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
22
The getDimensionPixelSize method of the Resources class returns the number of __________________ of a resource given its id.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 22 flashcards in this deck.