8.1 Fill in the blanks in each of the following statements:
a) SQLite database query results are managed via a(n) __________ (package android.database
).
b) To get a database operation’s results in the GUI thread, you use a(n) __________ (package android.os
) to perform the operation in one thread and receive the results in the GUI thread.
c) Fragment
method __________ returns the Bundle
of arguments to the Fragment
.
d) The Cursor
returned by method query
contains all the table rows that match the method’s arguments—the so-called __________.
8.2 State whether each of the following is true or false. If false, explain why.
a) It’s good practice to release resources like database connections when they are not being used so that other activities can use the resources.
b) It’s considered good practice to ensure that Cursor
method moveToFirst
returns false
before attempting to get data from the Cursor
.
c) It’s good practice to perform long-running operations or operations that block execution until they complete (e.g., file and database access) in the GUI thread.
d) SimpleCursorAdapter
is a subclass of CursorAdapter
that’s designed to simplify mapping Cursor
columns directly to TextView
s or ImagesView
s defined in your XML layouts.
e) A key benefit of using an SyncTask
is that it handles the details of creating threads and executing its methods on the appropriate threads for you, so that you do not have to interact with the threading mechanism directly.