Mobile Software Development Part 2

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

createTimerNotificationChannel() does not create a notification channel if the Timer app runs on what type of Android device?

7.0 and below

What location permission is a weather app likely to request if the app only needs to know the city the device is in?

ACCESS_COARSE_LOCATION not FINE_LOCATION

What method loads the animation resource and returns an Animation object?

AnimiationUtils.loadAnimation()

What does Geocoder do?

Class that can convert a geographic location to an address and vice versa.

What are the 3 components that Room defines?

Entity - class that defines the columns and keys of a database table. DAO - interface that defines methods for selecting, updating, inserting, and deleting entities. Database - extends roomDatabase provides DAOs

If the web API returns a 404 status code, what is output to the Logcat?

Error: com.android.volley.ClientError

What is an Executor?

Executes a runnable task on a background thread.

Settings fragment using PreferenceFragmentCompat.

Extension that creates settings screen in the onCreatePreference() method. setPreferencesFromResources() method inflates the PreferenceScreen XML to create the Settings screen.

(TF) A proximity sensor returns 0 for getMinDelay(), so a proximity sensor is a streaming sensor.

FALSE

(TF) An app may always access the app's files on external storage.

FALSE

(TF) Drawing is normally performed on a SurfaceView with code that exists inside a subclassed SurfaceView.

FALSE

(TF) Every Android device has a default sensor for every Android sensor type.

FALSE

(TF) Logcat messages appear when the main thread is unable to process 30fps.

FALSE

(TF) Making an inner AsyncTask class static prevents all memory leaks.

FALSE

(TF) The data Intent returned to onActivityResult() contains the full-sized photo taken by the camera app.

FALSE

(TF) The fused location provider relies primarily on GPS to discover a device's location.

FALSE

(TF) When an app is uninstalled, the app's files on internal storage are deleted, but the files on external storage remain.

FALSE

(TF) changeBrightness() is called after the user stops moving the SeekBar.

FALSE

(TF) saveAlteredPhoto() saves two different images to disk.

FALSE

(TF) The ValueAnimator below animates float values that start at 0 and end at 1. ValueAnimator animator = ValueAnimator.ofFloat(1, 0);

FALSE 1 to 0

(TF) Photo Express uses a FileProvider that provides access to files on internal storage.

FALSE <external-path> was used

(TF) Find Me requires ACCESS_COARSE_LOCATION permission to display a Google Map.

FALSE Maps SDK needs neither

(TF) A service typically displays a dialog to alert the user when something happens.

FALSE a service does not have UI

(TF) A notification always remains visible in the navigation drawer until the user removes the notification.

FALSE app can remove notification or replace

(TF) A notification cannot be seen once the heads-up notification disappears.

FALSE can be visible in notification drawer

(TF) The MediaPlayer.create() method loads and plays the given audio file.

FALSE doesn't play until start()

(TF) An app must implement the Camera API to take a photo.

FALSE just launch default camera app to take photo.

(TF) Notification details are only visible from the notification drawer.

FALSE long-pressing an app with a notification also reveals notification details

(TF) getSensorList() is likely to return about 5-10 sensors on a high-end phone.

FALSE more than 30 sensors

(TF) Changing SHAKE_THRESHOLD to 200 makes the app more sensitive to shaking.

FALSE raising threshold must mean higher for the app to recognize a shake.

(TF) zap.ogg must be added to the app's res/sound directory to be played by a MediaPlayer.

FALSE res/raw

(TF) A JobIntentService needs to start a background thread in onHandleIntent() to avoid blocking the main thread.

FALSE runs automatically on background thread.

(TF) If MainActivity runs on a physical device that sits face-up on a desk, and the device is pushed off the desk, sensorEvent.values[2] remains close to 9.81 while the device is in free fall.

FALSE z force cancels out gravitational force so 0

The "BLAH" permission in AndroidManifest.xml is an actual Android permission.

FALSE, Android 10 Camera app requires at least one permission to be used by the app

(TF) changeBrightness(0) makes the photo completely white.

FALSE, multiplier turns black

(TF) A subclassed AsyncTask must provide an implementation for onPreExecute().

False only doInBackground() must be implemented

Which of the following is not an argument to getUriForFile()?

FileProvider

Accelerometer

Force of acceleration due to gravity or movement. for tilt and orientation.

play(id,1,1,1,1,1) arguments

ID, left volume 0-1, right volume 0-1, priority 0 lowest, loop, playback rate.

Why is getSharedPreferences() method necessary?

If the app needs multiple preference files, but many apps only use a single default file.

What does the gps sensor do?

Retrieves latitude and longitude coordinates from GPS satelites

Which classes have a changeAcceleration() method?

RollerSurfaceView and RollerThread

Gyroscope

Rotation x y z who quickly an object rotates for gesture recognition.

What is the database engine embedded in Android?

SQLite

How to get a readable or writeable database.

SQLiteDatabase db = getWriteableDatabase(); SQLiteDatabase db = getReadableDatabase();

How to update data in a table?

SQLiteDatabase method update() using ContentValues object and returns the number of rows updated.

What is the Database inspector?

Tool to examine and modify an app's SQLite database while the app is running.

How to create a SharedPreferences object?

SharedPreferences sharedpref = getSharedPreferences("myprefs", context.MODE_PRIVATE); // getSharedPreferences() creates a private myprefs.xml file for storing preferences.

How to create an Editor for SharedPreferences?

SharedPreferences.Editor editor = sharedPref.edit(); // edit() returns an Editor for adding or changing key-values in the pref file.

ContentValues

Used by a ContentResolver to insert image metadata into the media store.

ContentResolver

Used to interact with the media store.

What is the NumberPicker?

a widget that allows the user to select a number from a limited range of numbers.

The translate uses the decelerate_interpolator, which starts quickly and then decelerates. What interpolator starts slowly and then accelerates?

accelerate_interpolator

class TestTask extends AsyncTask<Double, Integer, Boolean>

doInBackground() parameter type is double. Returns Boolean. onProgressUpdate() type is integer.

How to store key-values pair in the pref.xml file?

editor.putString("key", "value"); editor.apply(); saves the changes.

Example of getter methods

getInt(), getBoolean, getString(). two arguments key - string that identifies the key-value pair Default value - value that is returned if the preference file does not contain the key.

Sensor methods

getName() getType() getVendor() getVersion() getMinDelay()

What method requires values from an accelerometer and magnetic field sensor?

getRotationMatrix()

Inserting data into a database.

getWriteableDatabase() to obtain a writeable SQLiteDatabase object. ContentValues object is created, which holds the table columns and associated data to be inserted into a table. insert() inserts the data from the ContentValues row into the specified table and returns the new row's ID or -1 if an error occurred.

What method must be called to remove the subject from the RecyclerView?

notifyItemRemoved() (Adapter method)

Instead of sending the number 123 to the main thread, what property or method would the background thread use to attach a single Movie object to a Message?

obj for any type of object

What is decodeFile()?

obtain the image's size and creates a bitmap from a JPEG file.

Two callbacks for SensorEventListener

onAccuracyChanged() onSensorChanged() new raw data

What are the two Context methods to write and read from internal storage?

openFileOutput() - returns FileOutputStream. Throws a SecurityException if the second argument is not Context.MODE_PRIVATE openFileInput() - reutrns FileInputStream.

What is the Room persistence library?

provides an abstraction over SQLite.

If the ObjectAnimator is converted into an animation resource, what does the code below expect the file to be named? AnimatorInflater.loadAnimator( this, R.animator.warning_anim);

res/animator/warning_anim.xml

In what project directory should the animation drawable flying_rocket.xml be saved?

res/drawable

What property is animated? ObjectAnimator animator = ObjectAnimator.ofArgb(textView, "textColor"

textColor

timerModel.start() is called with an integer obtained from where?

MainActivity

The translate moves the rocket up the screen. What fromYDelta and toYDelta values are likely used? from down to up

0 and -900 0 because deltay is 0 at start -900 because -y is up

If the movie table is empty and addMovie() is called, what does addMovie() return?

1

What is the name of default preference files?

'ActivityName'.xml

What does this statement do SharedPreferences sharedPref = getPreferences(Context.MODE_PRIVATE); // Does not contain file name.

1. Creates a default preference file 2. The preference file cannot be read by other apps. 3. Does not erase contents of the default preference file but can replaced. editor.clear() removes values from the file NOTICE getPreference() for default instead of getSharedPreference()

The gyroscope values differ from the accelerometer when rotating. When the phone is upright, facing the user (Z-Rot = 0, X-Rot = 0, Y-Rot = 0), which of the gyroscope values change when the phone is rotating about the x axis?

1st

Which acceleration value changes the most when the X value is increased or decreased?

1st

If the camera app saves a photo that is 1600 × 1200 pixels, but the mPhotoImageView is only 800 × 400 pixels, what is the scaleFactor in displayPhoto()?

2

The figure above shows a phone that points northeast. What was azimuthAngle when the image was produced?

27

Which acceleration value changes the most when the Y value is increased or decreased?

2nd

res/anim xml element tags

<alpha> 1.0 is opage 0.0 is transparent <rotate> controls rotation <x,y> pivot <scale> <translate> <set> holds groups of transformation elements

Example of key-value pair in xml file

<map> <String name="username" value="Penguin"/> </map>

What xml tag surrounds the key-value pairs in the preference file?

<map> surrounds <string> and <int> key-value pairs.

What element must be added to AndroidManifest.xml to include a service component?

<service>

Elements of Shape Drawables in XML

<shape> type options are rectangle, oval, line, ring. <corners> radius of corners to produce rounded corners. <stroke> defines the outline of shape. <solid> defines solid color to fill shape. <gradient> gradient colors for coloring the shape

How to access drawable?

@drawable/myrectangle

Volley Objects

A RequestQueue manages worker threads that make HTTP requests and parse HTTP responses. A JsonObjectRequest object with a URL, Response.Listener, and Response.ErrorListener are added to the RequestQueue to make an HTTP request for a JSON response. A Response.Listener defines an onResponse() callback that is passed a JSONObject when the HTTP response is received. A JSONObject object is a set of name-value pairs created from JSON data. The values may be JSONObjects, JSONArrays, strings, booleans, and other number data types. A Response.ErrorListener defines an onErrorResponse() callback that is called if the HTTP response has a 4xx or 5xx error status code.

What is a Scoped storage?

A directory on internal or external storage where an app can read and write files only accessible to the app.

What is the fused location provider?

A location api in google play services.

How does app communicate with a thread.

A message supplies instructions stored in a message queue.

Notification

A message that appears in the Android device's status bar

What is a Snackbar message?

A newer alternative to toast that displays a pop-up message that disappears after a short period of time. Attach with CoordinatorLayout to allow dismissal with swiping. use Snackbar.make()

What is a blocked thread?

A thread that is busy and cannot process messages in the thread's message queue.

What is a view animation?

A tween animation on a View object. Can be in XML animation resource res/anim.

Motion sensors

Accelerometers, gyroscopes, gravity sensors, and rotational vector sensors.

When is the HTTP request sent to the web server?

After the JsonObjectRequest is added to the RequestQueue.

What is a service?

An application component that can perform long-running background tasks even when the user switches to another app.

What is Volley?

An http library that android apps may use to interact with a web API. Requires <uses-permission android:name="android.permission.INTERNET"/> in manifest and implementation 'com.android.volley:volley:1.1.1' dependency

What is the Handler class?

Allows a thread to send or handle Message and Runnable objects to/from a thread's message queue. Message object encapsulates the information passed to a thread.

Why is AlarmManager important?

Allows tasks to be scheduled at certain times.

What is a background thread?

Also called worker thread, a thread that runs lengthy operations on behalf of main thread so the app doesn't appear unresponsive.

What is the SharedPreference object?

An object that reads and writes key-value pairs to an XML preference file. getSharedPreferences() opens or creates a preference file given file name getPreferences() opens or creates a default preference file

What is a media store?

Android component that maintains a metadata table along with an index to various media.

What does ANR stand for?

Application not responding.

What does AGPS stands for

Assisted GPS (Gets gps info from cell towers) Global Positioning System

What does RollerThread.shake() do?

Calls RollerGame.newGame()

How to use camera?

Camera API in android.hardware.camera2 package to interact directly with the camera sensor.

Why is notification channel useful?

Can modify the behavior of notifications. IMPORTANCE_MIN does not appear in status bar _LOW does not make a sound _DEFAULT makes a sound _HIGH Sound and appears as a heads-up notification

Why is JobScheduler important?

Can schedule JobServices for execution when the device is charging, idle, connected to a network, or in other situations. Like install update when charging.

What does CAB stands for?

Contextual action bar appears at the top of the screen and presents actions the user can perform on currently selected items.

If azimuthAngle is 90, the ImageView is rotated which way?

Counterclockwise

How to write to a preference file?

Create a SharedPreferences.Editor by calling edit() on the SharedPreferences object. Putter methods includes putString(), putInt(), putBoolean, etc. which write key-value pairs to the Editor.

How to read and write external files on scoped storage?

Create a file object using context method getExternalFilesDir() which returns the full path on the external storage where the app can read and write files.

What does DAO stand for?

Data Access Object

Basic Rundown of SQLite

Database engine embedded in Android saving data in tables. Class extends SQLiteOpenHelper

What is the Android Studio tool that shows the file stored on a connected device or emulator?

Device File Explorer

Environment.Directory_pictures

Directory on ex storage

What is a custom drawable?

Drawable created at runtime. draw() draws graphic on canvas. setAlpha() set alpha value 0 transparent. setColorFilter() specifies color. getOpacitiy() returns transparency level

What are the two techniques for simple 2D animation?

Frame-by-frame animation shows a series of images in quick succession. Tween animation performs transformation

Gamify

Game loops, frames, framerate

What constructor creates a 3 column GridLayoutManager?

GridLayoutManager(context, 3)

What variable must be modified in createTimerNotificationChannel() so the channel's notifications are heads-up notifications?

Importance

Where can android app save text or binary data?

Internal storage is the device's internal, physical storage area. External storage is memory storage on an SD card or USB device.

If the URL's query string is changed to type=questions&subject=Finance, what is output to the Logcat?

JSON

What does JSON stand for?

JavaScript Object Notation

What class to implement service?

JobIntentService, automatically creates a background thread. Overrides onHandleWork() which gets called when work is available to execute.

what does android:keepScreenOn do?

Keep screen on even when user is not touching.

Benefits of a card view

Layout using cards or rectangles can display shadows or rounded corners.

What object contains a latitude and longitude?

Location

ofArgb() is likely defined in what Android version?

Lollipop (API level 21) introduced here

What are the two classes android use to play sound?

MediaPlayer for audio and video files SoundPool for short audio that may be repeated or played simultaneously

Sensors

Motion sensors - measures acceleration and rotational forces along the x, y z axis. Position sensors - physical position. Environmental sensors

What is missing to add the "Justice League" movie title to values?

MovieTable.COL_TITLE not just COL_TITLE

Can onSensorChanged() be called with accelerometer and magnetic field data at the same time?

NO

If invalidate() is removed from setNumCircles(), what is displayed in circlesView when the view is clicked?

No new circles are displayed

What does ORM stand for?

Object-Relational mapping library software that converts objects in an oop language into tables and queries in a relational database.

Position sensors

Orientation sensors and magnetometers

The notification priority in createTimerNotification() is set to PRIORITY_LOW, which is equivalent to the channel importance IMPORTANCE_LOW. If the Timer app runs on Android 7.0, what priority is needed to display a heads-up notification?

PRIORITY_HIGH

3 types when subclassing AsyncTask<Params, Progress, Result>

Params - type of parameters sent to do in background. Progress - type of progress units set to on progress update. Result - result sent to on post execute

URI

Points to the row inserted into the media store.

What is garbage collection?

Process of freeing unused memory in a managed memory system. Android automatically frees unused memory in a managed memory system.

What does Thread.sleep() do?

Puts the background thread to sleep for a specified number of milliseconds

What argument should load() use to load res/raw/boom.mp3?

R.raw.boom

Where are files stored for MediaPlayer/ SoundPool?

Raw resource in /res/raw directory. Given ID but not changed in anyway

What are some of the strategies to retrieve and store data?

Shared Preferences App-specific files Shared Storage Database Cloud

What is App-specific files?

Storing files in internal or external memory that only the app has permission to access.

What is Shared storage?

Storing images, audio, video, and other files to be shared with other apps.

What is Shared Preferences?

Storing private key-value pairs like strings, numbers, and other primitive data types.

What is Cloud?

Storing private or public data on the internet.

What is Database?

Storing private, structured data in a local database.

PreferenceScreen for app settings defined by 3 common subclasses.

SwitchPreferenceCompat - Shows a switch the user can turn on or off. ListPreference- shows a dialog with a list of items from which the user can choose. EditTextPreference - shows a dialog with an EditText widget, allowing the user to enter a string.

How to return the number of milliseconds since the Android system was booted?

SystemClock.uptimeMillis()

(TF) A RESTful web API allows an app to request data from a web server.

TRUE

(TF) A snackbar must have a button.

TRUE

(TF) A snackbar that displays a button should use a Snackbar.LENGTH_LONG duration.

TRUE

(TF) A toast and snackbar both show brief messages, but only a snackbar can be swiped.

TRUE

(TF) An activity should start a service instead of a background thread if the background task needs to execute when the user has navigated away from the app.

TRUE

(TF) An app appears unresponsive while the main thread is blocked.

TRUE

(TF) An app may always access the app's files on internal storage.

TRUE

(TF) Calling MediaPlayer.start() immediately after calling MediaPlayer.release() is a bad idea.

TRUE

(TF) Files stored in an app's scoped storage are by default not accessible to other apps.

TRUE

(TF) Google Play services must be installed on a device that uses the fused location provider.

TRUE

(TF) If getMinDelay() returns 10000, then the sensor returns data at least 100 times a second.

TRUE

(TF) If readFromInternalFile() is called before writeToInternalFile() the first time MainActivity is started, an exception is thrown.

TRUE

(TF) If the WeakReference method get() does not return null, the strong reference may be used safely.

TRUE

(TF) If the call to paint.setColorFilter() is removed from saveAlteredPhoto(), the altered image looks the same as the original image.

TRUE

(TF) Photo Express requires a device have a camera to download the app from Google Play Store.

TRUE

(TF) The MediaPlayer can play audio and video, but SoundPool can only play audio.

TRUE

(TF) The MediaPlayer is best for playing background music while the SoundPool plays short sound effects.

TRUE

(TF) The SurfaceView should not be drawn on before surfaceCreated() is called.

TRUE

(TF) The accelerometer is the only sensor needed to detect shaking.

TRUE

(TF) The user can simulate shaking in the Android emulator.

TRUE

(TF) Uninstalling an app deletes the app's SQLite .db file.

TRUE

(TF) Using the fused location provider requires a modification to the app's build.gradle file.

TRUE

(TF) When a SQLiteOpenHelper class is instantiated, onCreate() executes if no database exists.

TRUE

(TF) f getName() returns "Gravity", then getType() likely returns TYPE_GRAVITY.

TRUE

(TF) onUpgrade() is called only if the database version number is incremented.

TRUE

(TF) saveAlteredPhoto() saves an altered image that is the same width and height as the original image.

TRUE

(TF) startActivityForResult() should only be called if an activity is available that can respond to the implicit intent.

TRUE

(TF) surfaceDestroyed() is likely called if a SurfaceView is running on a device that is rotated.

TRUE

(TF) Only one of the AsyncTask's methods execute on a background thread.

TRUE doInBackground()

(TF) changeBrightness(150) makes the photo appear brighter.

TRUE, any number above 100

What to do to determine if an external storage exists?

The Environment static method getExternalStorageState() returns a string indicating if storage is writeable(Environment.MEDIA_MOUNTED), read-only(MEDIA_MOUNTED_READ_ONLY), or some other state.

If the user starts the Timer app, sets the timer for 10 seconds and presses Back before the timer completes, what happens next?

The TimerJobIntentService is started, but no notification displays

MediaStore.Images.Media.External_content_URI

The URI argument for the insert() method.

What caused a CalledFromWrongThreadException exception to be thrown in the animation?

The background thread tried updating the UI. Only main thread can update UI.

The location parameter in onSuccess() may be null in which situation?

The device's location service is turned off.

What is the apply() method in SharedPreferences.Editor?

The method saves the Editor's key-value pairs to the preference file.

If invalidate() is called from onDraw(), what happens?

The view quickly redraws new circles repeatedly.

What is the main thread?

Thread of execution sometimes called UI thread because the thread is responsible for running UI Code.

Thread scheduling

Timer and TimerTask classes can be used together to schedule background thread that repeatedly executes at regular intervals. ScheduledThreadPoolExecutor class can be used to execute multiple background threads on different schedules

What is a strong reference?

Typical java reference.

setUsage() purpose examples

USAGE_GAME _MEDIA _NOTIFICATION

What argument should setUsage() use for sounds that notify the user when an app's message limit is nearly reached?

USAGE_NOTIFICATION

The gyroscope values differ from the accelerometer when moving. Which of the gyroscope values change when the phone is moved in any direction? 1st 2nd Values are unchanged

Values are unchanged

When the Z value is increased and the phone moves toward the user, what happens initially to the z force values?

Values increase

The 3 levels of Emotional Design

Visceral - Appearance Behavioral - pleasure and effectiveness Reflective - rationalization and intellectualization

When might an ANR dialog box appear?

When events in the message queue have not been processed in several seconds.

When is the app's main thread created?

When the app is first executed.

When does the Runnable's run() execute?

When the thread is started.

AnimatorSet.Builder Coordination methods

after() before() with()

Environmental sensors

air temperature, air pressure, humidity, and illumination. barometers, photometers, and thermometers.

What attribute is missing to display myrectangle.xml in the TextView background?

android:background

What is Jank?

another name for skipped frames on the main thread.

App Preference attributes

app:title Primary preference text shown in the settings screen. app:summary Provides a preference description in a smaller font app:defaultValue Indicates the preference's default value. app:entries Specifies the string array that forms the selections in a ListPreference app:key Uniquely identifies the preference. app:entryValues Specifies the string array that indicates the values for the selections in a ListPreference.

What authority is likely used in an app created by Microsoft?

com.microsoft.example.fileprovider

Difference between editor.apply() and editor.commit()?

commit() returns boolean of success but runs on the same thread. apply() saves data in background thread but does not return success status. Best practice to use apply() if success status isn't needed.

What does a content URI begin with?

content://

MediaPlayer methods

create() loads from raw resource start() stop() release()

How to delete data in a table?

delete() deletes rows from a table and returns the number of rows deleted. Row is deleted but not shifted.

SensorManager methods

getDefaultSensor() getSensorList()

Why might inserting the values below cause insert() to return -1?

insert() internally throws a SQLiteConstraintException when an insert is attempted with a duplicate value on a primary key column like _id.

What does the invalidate() method do?

invalidates the view's drawing surface which results in android calling onDraw() to redraw the view. Only redraws a view when the view's surface is "invalid"

When the rocket is clicked, what method indicates if the AnimationDrawable is running?

isRunning()

SoundPool methods

load() loads audio raw resource returns sound id play() plays sound using sound id

If Resume is pressed, what line of code causes the UI to start showing the count down once again?

mHandler.post(mUpdateTimerRunnable);

Which line of code sends the first mUpdateTimerRunnable to the message queue?

mHandler.post(mUpdateTimerRunnable);

If Pause is pressed, what line of code prevents Runnables in the message queue from executing and updating the timer?

mHandler.removeCallbacks(mUpdateTimerRunnable);

What is an SQL injection attack?

malicious attacks where users enter inputs that alters the intent of a SQL statement. Can leak private information or delete data. Therefore using injection with rawQuery() and '?' is recommended.

What are the two method to define when extending SQLiteOpenHelper?

onCreate() when the database is created for the first time. Contains code to create the database. onUpgrade when the database needs upgrading if one or more tables need to be modified. Contains code to drop, create, or transfer from old to new tables.

AsyncTask Methods order

onPreExecute() doInBackground() onProgressUpdate() onPostExecute()

Registering a SensorEventListener is typically performed in what method?

onResume()

How to query information from a database?

rawQuery() methyod selects a data from a table and RETURNS a Cursor, an object that provides access to the results returned by the database query.

What is a weak reference?

reference that does not keep the garbage collector from feeing the referenced memory.

If a Runnable is in the message queue after the activity is destroyed, a memory leak results. What method could fix the leak by removing all the Runnables from the message queue?

removeCallbacks()

What is a streaming sensor?

returns sensor data at a regular rate.

Instead of sending the message immediately, what Handler method would the background thread call to send a Message to the main thread after 2 seconds had passed?

sendMessageDelayed()

Set properties of Notifications

setSmallIcon() sets the icon that is visible in the status bar. setContentTitle() sets the notificaiton title. setContentText() sets the notification text. setPriority() sets the notification priority for devices running android 7.0 or lower. Otherwise channel's importance determines it.

What is AsyncTask?

simplifies executing an asynchronous task on background thread and publishing the result on the main thread.

What code segment plays the sound with boomId repeatedly without stopping?

soundPool.play(boomId, 0.5f, 0.5f, 1, -1, 1) second to last argument is the loop argument -1 is to loop forever.

Display CAB

startActionMode() is called with an object that implements the ActionMode.Callback interface. ActionMode.Callback manages the lifecycle of the action mode. Cab closes when ActionMode.finish() is called.

What method starts the given Animation object?

startAnimation()

The garbage collector does not free an object that is referenced with a ______ reference.

strong

In which method is RollerThread instantiated and started?

surfaceCreated()

When registering a SensorEventListener, which sensor delay causes onSensorChanged() to be called most frequently?

the lower the microseconds the more frequent

What are the acceleration values (x, y, z) when the phone is lying on the phone's left side (Z-Rot = 90, X-Rot = 0, Y-Rot = 0)?

x is 9.81

What are the acceleration values (x, y, z) when the phone is upright (Z-Rot = 0, X-Rot = 0, Y-Rot = 0)?

y is 9.81

If the phone is lying on the phone's left side (Z-Rot = 90, X-Rot = 0, Y-Rot = 0), rotating about which axis causes the accelerometer values to remain unchanged?

y-rot

What are the acceleration values (x, y, z) when the phone is lying face down (Z-Rot = 0, X-Rot = 90, Y-Rot = 0)?

z is -9.81

What value is mOrientation[0] when the device points south?

π


Ensembles d'études connexes

Ch 1 Nursing Leadership: Decision Making, Problem Solving, Critical Thinking, and Clinical Reasoning: Requistes for successful leadership and management

View Set

2.1 Qualitative and Quantitative Variables

View Set

CHAPTER 6: SCIENCE AND ITS PRETENDERS

View Set

Anatomy & Physiology Chapter 10 Homework

View Set

CH 13 (Electrolytes) & CH 14 (Shock) PrepU

View Set