Deck 17: Android Development: Extending Views, Fragments, and Google Maps Permissions

Full screen (f)
exit full mode
Question
Inside strings.xml, write one line of code to define a string named message whose value is HI.
Use Space or
up arrow
down arrow
to flip the card.
Question
Inside the XML snippet, below activity_main.xml, add a line of XML so that the text displayed in the text field will be the value of the string book (assume that the string book is defined in strings.xml).
< TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
Question
Inside the XML snippet, below activity_main.xml, add two lines of XML so that the dimensions (width and height) of the TextView are just enough to hold the text inside the TextView.
< TextView
/>
Question
Inside the onCreate method, fill in the code to set the layout and GUI defined in activity_main.xml.
public void onCreate( Bundle savedInstanceState )
{
// Your code goes here
}
Question
Inside colors.xml, write the code to define a color named myColor that is blue.
Question
Assuming that a Logcat filter is already set with the tag MYTAG, write one statement to output ERROR to Logcat.
Question
Inside an activity element of the AndroidManifest.xml file, write the code so that this activity is supported only in vertical orientation.
< activity
android:name = ".MainActivity"
< !-- Your code goes here -->
< /activity>
Question
Inside an activity element of the AndroidManifest.xml file, write the code so that this activity is supported only in horizontal orientation.
< activity
android:name = ".MainActivity"
< !-- Your code goes here -->
< /activity>
Question
Inside the application element of the AndroidManifest.xml file, write the code so that the app icon is the icon stored in the file myicon.p n g in the mipmap directory.
< activity
android:name = ".MainActivity"
< !-- Your code goes here -->
< /activity>
Question
Inside activity_main.xml, write one line of code to specify the background color of the following TextView using a color resource named darkBlue defined in colors.xml:
< TextView
< !--your code goes here -->
Question
Inside activity_main.xml, write one line of code to specify the background color of the following TextView: its red component should be 0, its green component should be 255, and its blue component should be 10.
< TextView
< !--your code goes here -->
Question
Inside activity_main.xml, write one line of code to specify the background color of the following TextView: its transparency level should be 12, its red component should be 15, its green component should be 0, and its blue component should be 14.
< TextView
< !--your code goes here -->
Question
Inside styles.xml, define a style named myStyle so that paddingBottom is 15dp, and the background color is green.
Question
Inside activity_main.xml, write one line of code to specify that the TextView will be styled with the style named nice defined in styles.xml.
< TextView
< !--your code goes here -->
Question
Inside MainActivity.java, write the code to retrieve and assign to a TextView object reference a TextView element defined in activity_main.xml and whose id is look.
Question
Inside MainActivity.java, write the code to retrieve and assign to an EditText object reference an EditText element defined in activity_main.xml and whose id is input.
Question
Inside activity_main.xml, we define a Button element; when the user clicks on the button, we want the method go (from the MainActivity class, whose content view is defined in activity_main.xml) to execute. Write the code for it.
< Button
< !--your code goes here -->
Question
Inside MainActivity, we coded a private class named TW that implements the TextWatcher interface. We instantiated a TW object, and we want to register that TW object on an EditText named myET so that when the user inputs something in the EditText, the methods of the TW class execute. Write the code for it.
TW tw = new TW( );
// your code goes here
Question
Assign the width of the current screen to a variable name width.
// Your code goes here
Question
Write a code that creates a GridLayout within the current context and sets its number of rows to four and its number of columns to two.
// Your code goes here
Question
Inside the onCreate method, we created a GridLayout named grid. Write the code so that gridLayout is the View showing in this activity.
public void onCreate( Bundle savedInstanceState )
{
// The GridLayout grid has been created
// Your code goes here
}
Question
Write a code that creates a button within the current context.
// Your code goes here
Question
Write a code that creates a TextView within the current context.
// Your code goes here
Question
Write a code that creates a 5 × 2 two-dimensional array of buttons.
// Your code goes here
Question
You are building the GridLayout grid programmatically. You have already created a TextView named tv; add it to the GridLayout grid, specifying a width of 200 and a height of 100.
Question
You have created the private class BH, which implements the View.OnClickListener interface. Inside the onCreate method of the current activity, a Button b has been created. Write two lines of code to register an object of BH on the Button b.
// Button b has already been created and instantiated
Question
Write a code that checks whether the button that was clicked is a button named b. If it is, it outputs to Logcat YES; otherwise, it outputs to Logcat NO (using the tag MA).
private class ButtonHandler implements View.OnClickListener
{
public void onClick( View v )
{
// Your code goes here
}
}
Question
LayoutParams is an inner class of GridLayout. Declare an object reference of type LayoutParams (the inner class of GridLayout).
Question
Write a code that sets the background color of the TextView tv to red.
Question
We want to define an area (a GridLayout.LayoutParams) within a GridLayout that starts at the first square of the grid and spans three rows and five columns. Write the code for it.
Question
The MyDialog private class implements the OnClickListener inner interface of DialogInterface. Write a minimum implementation of the MyDialog class (so that it compiles).
Question
Inside a TableLayout, define a TableRow such that it is as big as necessary and has two elements: a Button and a TextView. The Button's text is GO, and the TextView's text is RESULT. The Button's id is go. The text inside the TextView element has 15 pixels of padding.
Question
Write a code that draws a blue line that is 2 pixels thick.
< !-- blue line; your code goes here -->
Question
Inside a RelativeLayout element, write the code that asks an EditText whose id is age and that is positioned to the right of the View whose id is name; its right edge is lined up with its parent View.
< EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
< !-- Your code goes here -->
android:inputType="numberDecimal" />
Question
Inside the AndroidManifest.xml file, add an activity element of the type MyActivity class and whose label is the value of the string my_app (specified in the strings.xml file).
< /activity>
< !-- Your code goes here -->
< /application>
Question
We are coding inside an Activity class. Write the code inside the goToSecondActivity method so that we start a new activity from the MyActivity class.
public void goToSecondActivity( View v )
{
// Your code goes here
}
Question
You are coding an app with two activities, and you are coding inside the second activity, which is created from the first activity. Write one line of code to pop the current activity off the stack and go back to the first activity.
Question
The following code defines a transition between two activities. Add the code so that it lasts 5 seconds.
< ?xml version="1.0" encoding="utf-8"?>
< set xmlns:android="http://schemas.android.com/apk/res/android">
< translate
android:fromYDelta="-100%"
android:toYDelta="0"
< !--Your code goes here -->
< /set>
Question
We want to make the app go from the current activity to a new activity of type MyActivity. The new screen comes with an animation defined in the file abc.xml located in the anim directory of the resources directory. Write the code for this.
Question
Inside an Activity class, write the code to retrieve an integer value written earlier by this app as a user preference. Assume that the integer has been written using the key ABC. If the corresponding value cannot be found, use a default value of 1.
Question
Inside an Activity class, write a line of code to get a SharedPreferences reference.
Question
We have already obtained a SharedPreferences.Editor reference named editor. Write the code to store the value 100 and associate it with the key NUMBER.
// editor is a SharedPreferences.Editor reference
// Your code goes here
Question
You are creating a menu. Add two lines of code so that the following menu item has the title defined in the string named go (defined in strings.xml) and has an id of abc.
< menu …>
< item
< !--Your code goes here-->
app:showAsAction="ifRoom"/>

/>
Question
The DB class extends SQLiteOpenHelper. The name of our database is MYDB, and its version is 0. Code the constructor of DB.
Question
Inside a class that extends SQLiteOpenHelper, write one statement to obtain a reference to a SQLiteDatabase.
Question
Inside an Activity class, write a statement that creates and shows a Toast that lasts 3 seconds and says HI.
Question
Inside an Activity class, a RelativeLayout named rl has been created. Write two statements to make its contents scrollable.
Question
You are creating a menu. Add one line of code so that the following menu item has the icon defined in the my_icon.p n g file located in the drawable directory of the resources directory.
< menu …>
< item
< !--Your code goes here-->

/>
Question
Write the code to get a Configuration reference.
Question
config is a Configuration reference. Write one line of code to assign the orientation value of the device to an int variable.
Question
res is a Resources reference. Write one or two lines of code to retrieve the pixel density of the device.
Question
We have a file named abc.p n g in the drawable directory of the resources directory. Write the code to create a Bitmap reference using that file.
Question
MVC stands for ____________.
Question
The constant ____________ of the ViewGroup.LayoutParameters class corresponds to the value wrap_content of the android:layout_width and android:layout_height attributes.
Question
The direct superclass of RelativeLayout, LinearLayout, and GridLayout is ____________.
Question
The ____________ element defines a row inside a TableLayout.
Question
The ____________ method of the Activity class is automatically called after the onCreate method is called when the activity becomes visible to the user.
Question
The ____________ method of the current Activity class is automatically called when the user starts or resumes a different activity.
Question
onCreate is one of the two abstract methods of SQLiteOpenHelper; the other abstract method is ____________.
Question
The ____________ method of the View.OnTouchListener interface is called when the user touches the screen.
Question
The getAction method of the MotionEvent class returns an integer. We can compare that integer to the ____________ constant of the MotionEvent class if we want to test whether the user moved his or her finger on the screen.
Question
The View child is inside the View parent but is under another View, so we can see only part of it. We can use the ____________ method to bring the child to the front so that we can see it completely.
Question
The ____________ method of the GestureDetector.OnGestureListener is called when the user swipes the screen.
Question
The ____________ class encapsulates a bitmap.
Question
The ____________ class enables us to draw shapes and bitmaps.
Question
The ____________ class enables us to define the style and color for drawing.
Question
We can use the ____________ method of the Canvas class to draw a rectangle.
Question
We can use the ____________ method of the Canvas class to draw a circle.
Question
We can use the ____________ method of the Canvas class to draw a bitmap.
Question
We can use the ____________ method of the Canvas class to draw a string.
Question
The ____________ class, part of the android.media package, enables us to manage and play sounds.
Question
Inside the XML snippet below activity_main.xml, add two lines of XML so that the width of the TextView is as big as the width of the TextView's parent, and the height of the TextView is just what is necessary to hold the TextView's contents.
< TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
Question
A TextView is defined in activity_main.xml and given the id tv. Inside MainActivity.java, write the code to retrieve that TextView and change its text to CHANGED.
Question
Inside activity_main.xml, we defined a Button element in such a way that when the user clicks on the button, the go method (from the MainActivity class, whose content view is defined in activity_main.xml) executes. When the user clicks on the button, we want to change the text of that button to CHANGED. Write the go method.
Question
Inside an Activity class, and assuming that a GridLayout named gl has been instantiated, write the code to create a Button and add it to gl, setting its width to the width of the screen and its height to 100.
Question
Code a private class that implements the View.OnClickListener interface; override its only method so that it changes the text of the View parameter of that method to CHANGED (assume that View is a Button).
Question
Inside a RelativeLayout element, insert code that adds an EditText element as follows:
Its bottom edge is aligned with the bottom edge of an element whose id is a.
Its left edge is aligned with the left edge of an element whose id is b.
< EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
< !-- Your code goes here -->
android:inputType="numberDecimal" />
Question
Inside an activity, when this activity goes in the background, we want to output HI to Logcat using the tag MA. Write the code for it.
Question
db is a SQLiteDatabase reference; sql is a String representing a delete SQL statement. Write a statement to execute that SQL statement.
Question
db is a SQLiteDatabase reference; sql is a String representing a select SQL statement. Write a statement to execute that SQL statement and assign the result to an object reference of the appropriate data type.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/127
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 17: Android Development: Extending Views, Fragments, and Google Maps Permissions
1
Inside strings.xml, write one line of code to define a string named message whose value is HI.
< string name="message">HI< /string>
2
Inside the XML snippet, below activity_main.xml, add a line of XML so that the text displayed in the text field will be the value of the string book (assume that the string book is defined in strings.xml).
< TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
android:text="@string/book"
3
Inside the XML snippet, below activity_main.xml, add two lines of XML so that the dimensions (width and height) of the TextView are just enough to hold the text inside the TextView.
< TextView
/>
android:layout_height="wrap_content"
android:layout_height="wrap_content"
4
Inside the onCreate method, fill in the code to set the layout and GUI defined in activity_main.xml.
public void onCreate( Bundle savedInstanceState )
{
// Your code goes here
}
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
5
Inside colors.xml, write the code to define a color named myColor that is blue.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
6
Assuming that a Logcat filter is already set with the tag MYTAG, write one statement to output ERROR to Logcat.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
7
Inside an activity element of the AndroidManifest.xml file, write the code so that this activity is supported only in vertical orientation.
< activity
android:name = ".MainActivity"
< !-- Your code goes here -->
< /activity>
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
8
Inside an activity element of the AndroidManifest.xml file, write the code so that this activity is supported only in horizontal orientation.
< activity
android:name = ".MainActivity"
< !-- Your code goes here -->
< /activity>
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
9
Inside the application element of the AndroidManifest.xml file, write the code so that the app icon is the icon stored in the file myicon.p n g in the mipmap directory.
< activity
android:name = ".MainActivity"
< !-- Your code goes here -->
< /activity>
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
10
Inside activity_main.xml, write one line of code to specify the background color of the following TextView using a color resource named darkBlue defined in colors.xml:
< TextView
< !--your code goes here -->
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
11
Inside activity_main.xml, write one line of code to specify the background color of the following TextView: its red component should be 0, its green component should be 255, and its blue component should be 10.
< TextView
< !--your code goes here -->
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
12
Inside activity_main.xml, write one line of code to specify the background color of the following TextView: its transparency level should be 12, its red component should be 15, its green component should be 0, and its blue component should be 14.
< TextView
< !--your code goes here -->
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
13
Inside styles.xml, define a style named myStyle so that paddingBottom is 15dp, and the background color is green.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
14
Inside activity_main.xml, write one line of code to specify that the TextView will be styled with the style named nice defined in styles.xml.
< TextView
< !--your code goes here -->
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
15
Inside MainActivity.java, write the code to retrieve and assign to a TextView object reference a TextView element defined in activity_main.xml and whose id is look.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
16
Inside MainActivity.java, write the code to retrieve and assign to an EditText object reference an EditText element defined in activity_main.xml and whose id is input.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
17
Inside activity_main.xml, we define a Button element; when the user clicks on the button, we want the method go (from the MainActivity class, whose content view is defined in activity_main.xml) to execute. Write the code for it.
< Button
< !--your code goes here -->
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
18
Inside MainActivity, we coded a private class named TW that implements the TextWatcher interface. We instantiated a TW object, and we want to register that TW object on an EditText named myET so that when the user inputs something in the EditText, the methods of the TW class execute. Write the code for it.
TW tw = new TW( );
// your code goes here
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
19
Assign the width of the current screen to a variable name width.
// Your code goes here
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
20
Write a code that creates a GridLayout within the current context and sets its number of rows to four and its number of columns to two.
// Your code goes here
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
21
Inside the onCreate method, we created a GridLayout named grid. Write the code so that gridLayout is the View showing in this activity.
public void onCreate( Bundle savedInstanceState )
{
// The GridLayout grid has been created
// Your code goes here
}
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
22
Write a code that creates a button within the current context.
// Your code goes here
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
23
Write a code that creates a TextView within the current context.
// Your code goes here
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
24
Write a code that creates a 5 × 2 two-dimensional array of buttons.
// Your code goes here
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
25
You are building the GridLayout grid programmatically. You have already created a TextView named tv; add it to the GridLayout grid, specifying a width of 200 and a height of 100.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
26
You have created the private class BH, which implements the View.OnClickListener interface. Inside the onCreate method of the current activity, a Button b has been created. Write two lines of code to register an object of BH on the Button b.
// Button b has already been created and instantiated
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
27
Write a code that checks whether the button that was clicked is a button named b. If it is, it outputs to Logcat YES; otherwise, it outputs to Logcat NO (using the tag MA).
private class ButtonHandler implements View.OnClickListener
{
public void onClick( View v )
{
// Your code goes here
}
}
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
28
LayoutParams is an inner class of GridLayout. Declare an object reference of type LayoutParams (the inner class of GridLayout).
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
29
Write a code that sets the background color of the TextView tv to red.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
30
We want to define an area (a GridLayout.LayoutParams) within a GridLayout that starts at the first square of the grid and spans three rows and five columns. Write the code for it.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
31
The MyDialog private class implements the OnClickListener inner interface of DialogInterface. Write a minimum implementation of the MyDialog class (so that it compiles).
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
32
Inside a TableLayout, define a TableRow such that it is as big as necessary and has two elements: a Button and a TextView. The Button's text is GO, and the TextView's text is RESULT. The Button's id is go. The text inside the TextView element has 15 pixels of padding.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
33
Write a code that draws a blue line that is 2 pixels thick.
< !-- blue line; your code goes here -->
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
34
Inside a RelativeLayout element, write the code that asks an EditText whose id is age and that is positioned to the right of the View whose id is name; its right edge is lined up with its parent View.
< EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
< !-- Your code goes here -->
android:inputType="numberDecimal" />
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
35
Inside the AndroidManifest.xml file, add an activity element of the type MyActivity class and whose label is the value of the string my_app (specified in the strings.xml file).
< /activity>
< !-- Your code goes here -->
< /application>
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
36
We are coding inside an Activity class. Write the code inside the goToSecondActivity method so that we start a new activity from the MyActivity class.
public void goToSecondActivity( View v )
{
// Your code goes here
}
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
37
You are coding an app with two activities, and you are coding inside the second activity, which is created from the first activity. Write one line of code to pop the current activity off the stack and go back to the first activity.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
38
The following code defines a transition between two activities. Add the code so that it lasts 5 seconds.
< ?xml version="1.0" encoding="utf-8"?>
< set xmlns:android="http://schemas.android.com/apk/res/android">
< translate
android:fromYDelta="-100%"
android:toYDelta="0"
< !--Your code goes here -->
< /set>
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
39
We want to make the app go from the current activity to a new activity of type MyActivity. The new screen comes with an animation defined in the file abc.xml located in the anim directory of the resources directory. Write the code for this.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
40
Inside an Activity class, write the code to retrieve an integer value written earlier by this app as a user preference. Assume that the integer has been written using the key ABC. If the corresponding value cannot be found, use a default value of 1.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
41
Inside an Activity class, write a line of code to get a SharedPreferences reference.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
42
We have already obtained a SharedPreferences.Editor reference named editor. Write the code to store the value 100 and associate it with the key NUMBER.
// editor is a SharedPreferences.Editor reference
// Your code goes here
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
43
You are creating a menu. Add two lines of code so that the following menu item has the title defined in the string named go (defined in strings.xml) and has an id of abc.
< menu …>
< item
< !--Your code goes here-->
app:showAsAction="ifRoom"/>

/>
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
44
The DB class extends SQLiteOpenHelper. The name of our database is MYDB, and its version is 0. Code the constructor of DB.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
45
Inside a class that extends SQLiteOpenHelper, write one statement to obtain a reference to a SQLiteDatabase.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
46
Inside an Activity class, write a statement that creates and shows a Toast that lasts 3 seconds and says HI.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
47
Inside an Activity class, a RelativeLayout named rl has been created. Write two statements to make its contents scrollable.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
48
You are creating a menu. Add one line of code so that the following menu item has the icon defined in the my_icon.p n g file located in the drawable directory of the resources directory.
< menu …>
< item
< !--Your code goes here-->

/>
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
49
Write the code to get a Configuration reference.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
50
config is a Configuration reference. Write one line of code to assign the orientation value of the device to an int variable.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
51
res is a Resources reference. Write one or two lines of code to retrieve the pixel density of the device.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
52
We have a file named abc.p n g in the drawable directory of the resources directory. Write the code to create a Bitmap reference using that file.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
53
MVC stands for ____________.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
54
The constant ____________ of the ViewGroup.LayoutParameters class corresponds to the value wrap_content of the android:layout_width and android:layout_height attributes.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
55
The direct superclass of RelativeLayout, LinearLayout, and GridLayout is ____________.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
56
The ____________ element defines a row inside a TableLayout.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
57
The ____________ method of the Activity class is automatically called after the onCreate method is called when the activity becomes visible to the user.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
58
The ____________ method of the current Activity class is automatically called when the user starts or resumes a different activity.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
59
onCreate is one of the two abstract methods of SQLiteOpenHelper; the other abstract method is ____________.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
60
The ____________ method of the View.OnTouchListener interface is called when the user touches the screen.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
61
The getAction method of the MotionEvent class returns an integer. We can compare that integer to the ____________ constant of the MotionEvent class if we want to test whether the user moved his or her finger on the screen.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
62
The View child is inside the View parent but is under another View, so we can see only part of it. We can use the ____________ method to bring the child to the front so that we can see it completely.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
63
The ____________ method of the GestureDetector.OnGestureListener is called when the user swipes the screen.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
64
The ____________ class encapsulates a bitmap.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
65
The ____________ class enables us to draw shapes and bitmaps.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
66
The ____________ class enables us to define the style and color for drawing.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
67
We can use the ____________ method of the Canvas class to draw a rectangle.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
68
We can use the ____________ method of the Canvas class to draw a circle.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
69
We can use the ____________ method of the Canvas class to draw a bitmap.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
70
We can use the ____________ method of the Canvas class to draw a string.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
71
The ____________ class, part of the android.media package, enables us to manage and play sounds.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
72
Inside the XML snippet below activity_main.xml, add two lines of XML so that the width of the TextView is as big as the width of the TextView's parent, and the height of the TextView is just what is necessary to hold the TextView's contents.
< TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
73
A TextView is defined in activity_main.xml and given the id tv. Inside MainActivity.java, write the code to retrieve that TextView and change its text to CHANGED.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
74
Inside activity_main.xml, we defined a Button element in such a way that when the user clicks on the button, the go method (from the MainActivity class, whose content view is defined in activity_main.xml) executes. When the user clicks on the button, we want to change the text of that button to CHANGED. Write the go method.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
75
Inside an Activity class, and assuming that a GridLayout named gl has been instantiated, write the code to create a Button and add it to gl, setting its width to the width of the screen and its height to 100.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
76
Code a private class that implements the View.OnClickListener interface; override its only method so that it changes the text of the View parameter of that method to CHANGED (assume that View is a Button).
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
77
Inside a RelativeLayout element, insert code that adds an EditText element as follows:
Its bottom edge is aligned with the bottom edge of an element whose id is a.
Its left edge is aligned with the left edge of an element whose id is b.
< EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
< !-- Your code goes here -->
android:inputType="numberDecimal" />
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
78
Inside an activity, when this activity goes in the background, we want to output HI to Logcat using the tag MA. Write the code for it.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
79
db is a SQLiteDatabase reference; sql is a String representing a delete SQL statement. Write a statement to execute that SQL statement.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
80
db is a SQLiteDatabase reference; sql is a String representing a select SQL statement. Write a statement to execute that SQL statement and assign the result to an object reference of the appropriate data type.
Unlock Deck
Unlock for access to all 127 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 127 flashcards in this deck.