Deck 14: Making an Android Widget
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/35
Play
Full screen (f)
Deck 14: Making an Android Widget
1
App widgets, also known as widgets, are small apps that are embedded in other apps, called app widget hosts.
True
2
The Home screen and the ____________ screen are examples of app widget hosts.
Lock
3
It is possible to style a widget with colors.
True
4
What method of the RemoteViews class is the equivalent of the setText method of the TextView class?
A) setText
B) setViewText
C) setTextViewText
D) setTextView
A) setText
B) setViewText
C) setTextViewText
D) setTextView
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
5
The minimum time between automatic updates for a widget is 30 minutes.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
6
What static method of the PendingIntent class can we use to create a PendingIntent?
A) createIntent
B) createPendingIntent
C) makePendingIntent
D) getBroadcast
A) createIntent
B) createPendingIntent
C) makePendingIntent
D) getBroadcast
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
7
A JSON string can include two data structures: an object and a(n) ____________.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
8
It is possible to let the user customize a widget based on some user input.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
9
What is another name for the Lock screen?
A) Key
B) Guard
C) Keyguard
D) GuardKey
A) Key
B) Guard
C) Keyguard
D) GuardKey
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
10
The AppWidgetProviderInfo includes two constants that correspond to the Home screen and Lock screen widget categories.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
11
To create a widget, we need to extend the ____________ class or the BroadcastReceiver class.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
12
What is the name of the class that describes the metadata in a widget provider, such as icon and minimum width and height?
A) WidgetInfo
B) AppWidgetInfo
C) AppWidgetProviderInfo
D) ProviderInfo
A) WidgetInfo
B) AppWidgetInfo
C) AppWidgetProviderInfo
D) ProviderInfo
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
13
To create a widget, we define an AppWidgetProviderInfo object in an XML ____________ located in the res/xml directory.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
14
The URL class encapsulates a URL.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
15
The openConnection method of the URL class returns a(n) ____________ reference.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
16
The getInputStream method from the URLConnection class returns an InputStream.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
17
The AsyncTask class, from the android.os package, allows us to perform a task in the ____________.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
18
What package contains classes that enable us to create and manage widgets?
A) android.widgets
B) android.appwidget
C) widget.android
D) widget.app
A) android.widgets
B) android.appwidget
C) widget.android
D) widget.app
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
19
What method of the AppWidgetProvider class is called when the last widget of a type of widget is deleted from the host screen?
A) onDone
B) onDisabled
C) onUninstalled
D) onDestroyed
A) onDone
B) onDisabled
C) onUninstalled
D) onDestroyed
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
20
What method of the RemoteViews class is the equivalent of the setTextColor method of the TextView class?
A) setColor
B) setTextColor
C) setTextViewTextColor
D) setTextViewColor
A) setColor
B) setTextColor
C) setTextViewTextColor
D) setTextViewColor
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
21
Which one of these strings is the only valid JSON string?
A) { "cities": ("New York", "Palo Alto", "Boston") }
B) { "cities": {"New York", "Palo Alto", "Boston"} }
C) [ "cities": {"New York", "Palo Alto", "Boston"} ]
D) { "cities": ["New York", "Palo Alto", "Boston"] }
A) { "cities": ("New York", "Palo Alto", "Boston") }
B) { "cities": {"New York", "Palo Alto", "Boston"} }
C) [ "cities": {"New York", "Palo Alto", "Boston"} ]
D) { "cities": ["New York", "Palo Alto", "Boston"] }
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
22
What method of the AsyncTask class is automatically called after doInBackground finishes?
A) run
B) execute
C) onPostExecute
D) finish
A) run
B) execute
C) onPostExecute
D) finish
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
23
What attribute, included in the XML file defining the AppWidgetProviderInfo for the widget, specifies the frequency of updates of the widget?
A) android:updatePeriodMillis
B) android:millis
C) android:update
D) android:periodic
A) android:updatePeriodMillis
B) android:millis
C) android:update
D) android:periodic
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
24
What attribute, included in the XML file defining the AppWidgetProviderInfo for the widget, specifies the XML layout resource of the widget?
A) android:layout
B) android:view
C) android:initialLayout
D) android:xml
A) android:layout
B) android:view
C) android:initialLayout
D) android:xml
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
25
What method of the AppWidgetProvider class is called when the widget first runs and when the widget is updated?
A) onRun
B) onStart
C) onUpdate
D) onRestart
A) onRun
B) onStart
C) onUpdate
D) onRestart
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
26
The getJSONObject method of the JSONObject class has this API:
JSONObject getJSONObject( String name )
What does it return?
A) The JSONObject calling that method
B) The JSONObject mapped to name if there is one
C) The string name
D) null
JSONObject getJSONObject( String name )
What does it return?
A) The JSONObject calling that method
B) The JSONObject mapped to name if there is one
C) The string name
D) null
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
27
Widgets can receive periodic updates.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
28
If we allow the user to configure the widget, we need to add to the app-provider element an android:configure attribute in the widget configuration XML file.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
29
There are no restrictions regarding the use of Views and layout managers inside a widget.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
30
A RemoteViews reference can be obtained by inflating an XML resource.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
31
It is possible to test a widget inside the emulator.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
32
The execute method of the AsyncTask class accepts a variable number of arguments.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
33
The __________________ method of the AppWidgetManager sets the RemoteViews for a widget based on its id.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
34
The JSONObject class, part of the org.json package, includes methods to parse a __________________ string.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
35
The AsyncTask class uses three generic types that we must specify when extending it. The class header of a subclass is as follows:
AccessModifier ClassName extends AsyncTask< Params, Progress, Result>
where Params, Progress, and Result are placeholders for actual __________________ names.
AccessModifier ClassName extends AsyncTask< Params, Progress, Result>
where Params, Progress, and Result are placeholders for actual __________________ names.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck