Android Midterm

Ace your homework & exams now with Quizwiz!

Which values file gives font sizes in landscape mode?

res/values-land/dimens.xml

Which values file gives font sizes in portrait mode?

res/values/dimens.xml

Which values file defines title, prompts, and button labels for all Activities in this section?

res/values/strings.xml

To set the type of a map, call the GoogleMap object's _____________ method

setMapType()

What is the significance of %n as it relates to printf?

signifies end of line

The Android Camera application saves a full-size photo if you give it a file to save into. You must provide a path that includes the __________________, ________________, __________________

storage volume, folder, and file name

Which method builds strict-JSON string from JSONObject?

toString

Define the map _____ to govern the overall representation of the map

type

Which static method returns a String containing entire content of address and uses GET

urlContent(address);

Which static method returns a String containing entire content of address and uses POST

urlContentPost(address);

What is the property name for getUserFirstName?

userFirstName

what is the printf formatting option for decimal?

%d

what is the printf formatting option for floating point?

%f

what is the printf formatting option for string?

%s

what is the printf formatting option for time/date?

%t

Supercell recently announced its ______ _______strategy, which puts game development for the tablet front and center to meet the demand for engaging game experiences on the platform

'tablet first'

What are the steps for talking to a server using a socket object?

1) Create a socket object 2) Create output stream to send data to the Socket - when println is calledPrintWriter out =new PrintWriter(client.getOutputStream(), true); 3.Create input stream to read response from serverBufferedReader in =new BufferedReader(new InputStreamReader(client.getInputStream()));

What are the two methods that can be used to use the camera on the Android device ?

1) via directly integrate the camera into your app using Camera API 2) via the integration of existing camera app ( via Intent and use the return data of the app to access the result ).

What are some ways location can be determined for mobiles?

A- GPS, Satellite GPS, Cell Tower ID, Bluetooth, Enhanced 911

Map application needs an _____ _____ to access the Google Maps serve

API Key

Where does an app specify permission for the internet?

AndroidManifest.xml

declare a new buffered reader which uses an instance of a socket named "socket"

BufferedReader in = new SocketUtils.getSocket(socket);

Write code that reads data from an HTTPUrlConnection called connection

BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));

To access the device camera, you must declare the _________ permission in your Android Manifest. Also be sure to include the _________ manifest element to declare camera features used by your application

CAMERA, <uses-feature>

The ______ class - set image capture settings; - start/stop preview; - snap pictures; - retrieve frames for encoding for video

Camera

The Camera class is a client for the ________ _______, which manages the actual camera hardware

Camera service

To enumerate, query, and open available camera devices, obtain a __________________ instance.

CameraManager

What are three events associated with a marker?

ClickEvents, DragEvents, InfoWindowClickEvents

Construct a _____________________ object and use its _____ methods to insert values into db rows

ContentValues, put + database.insert

Construct a _______________ object and use its _____ methods to provide a value for each column. Update the row :

ContentValues, put + database.open

The ________ is the mechanism with which we navigate results from a database query and read rows and columns

Cursor

Which class do you use to open an instance of SQLiteDatabase?

DatabaseOpenHelper

NIST sponsors several servers with high-precision time• The simplest to read is ______ ______ ,which returns the time on the second line of the responseto a connection

Daytime Protocol

Which fragment subclass is a fragment that displays a dialog window, floating on top of its activity's window?

DialogFragment

Order these in terms of verbosity, from least to most: VERBOSE ERROR INFO DEBUG WARN

ERROR, WARN, INFO, DEBUG, VERBOSE

True or False: Fragments don't usually have a UI

False

True or False: Markers are draggable by default

False

True or False: You have to create a db connection (like JDBC or ODBC) in order to connect to SQLite

False

True or False: A fragment can be embedded inside or placed outside an activity

False. Can only be embedded in an Acitivity

True or False: SQLite is a client-server database engine?

False. It is embedded into the end program

True or False: If fragment stack is not empty, pressing Back button navigates the user to the latest Activity

False. It will navigate to the last fragment in that activity

True or False: openConnection's default method is POST

False. It's GET

True or False: Google Maps Navigation for Android 2.0 cost .99 cents

False. It's free.

True or False: According to JSON rules, Object property names must be in single quotes

False. They must be in double quotes

To make fragment transactions in your activity, you must use APIs from_________________

FragementTransaction

To create a fragment, extend the _________ class, then override key lifecycle methods to insert your app logic

Fragment

Unlike a View, a _________ represents a behavior or a portion of user interface in an activity. Y

Fragment

Typically ________________ view is used as a placeholder in the Activity's XML file

FrameLayout

Which image format is discouraged?

GIF

Name three popular web services that use JSON data?

Google apis, Twitter apis, Flickr

Which class be receive the response from openConnection and let's you read the status code, let's you set the request header, lets you read the response heads, and has a special case for cookies?

HTTPUrlConnection

Which class offers a simple way to read an entire URL (via GET) into String

HttpClient

Which server communication class allows you to download the entire content of a URL?

HttpClient

Write code to make a default client called "client"

HttpClient client = new DefaultHttpClient();

Write code to make an HttpGet called httpget with an address called "address"

HttpGet httpget = new HttpGet(address);

Write code to make an HttpPost with address called "address"

HttpPost httppost = new HttpPost(address);

Which server communication class simplifies connections to HTTP servers?

HttpURLConnection

What kind of exception: - Timeout - Connection refused by server - Interruption or other unexpected problem

IOException

The Android way of delegating actions to other applications is to invoke an ________ that describes what you want done

Intent

Create an Intent to capture a picture

Intent pictureIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);

What is the problem with the JSON-in-Java library from json.org that is bundled with Android?

It doesn't document properly which version it uses, and the version it uses is long obsolete and is lacking JSON-from-bean capability

Simple format widely used in Ajax and Web services

JSON

What offers a simple textual representation of (JavaScript) objects

JSON

Which JSON constructor is not in Android version and cannot be used directly on Android?

JSON bean

Which class represents an array of JSON. and although it can be used to send data from Android, it is usually used to receive data?

JSONArray

Converts string into JSON

JSONObject

Which server connection class simplifies creation and parsing of JSON data?

JSONObject

_______ is an immutable class representing a pair of latitude and longitude coordinates, stored as degrees.

LatLng

Write code to make a List of name/value pairs

List<NameValuePair> params = new ArrayList<NameValuePair>();

Which fragment subclass displays a list of items by binding to a data source such as an array or Cursor, and exposes event handlers when the user selects an item?

ListFragment

______ ________ is the way to place a map in an application. It's a wrapper around a view of a map to automatically handle the necessary life cycle needs.

Map Fragment

What are the 2 methods you can use to modify the position of a camera?

Map.moveCamera(cameraPosition) Map.animateCamera(cameraPosition)

A ________________ is a container of the GoogleMap object, which is a View containing the map and managing the

MapFragment

__________ indicate single locations on the map

Markers

Intent action types for images are

MediaStore.ACTION_IMAGE_CAPTURE MediaStore.ACTION_VIDEO_CAPTURE

Which camera intent action type can be used without directly accessing the Camera object?

MediaStore.ACTION_VIDEO_CAPTURE

Name three map types

Normal, Hybrid, Satellite, Terrain, None

What listener implementing interface method do OnInfoWindowClick use for Markers

OnInfoWindowClickListener onInfoWindowClick(marker)

_______ is the most common image format given its preference in earlier versions of Android, and growing popularity on the Web in general

PNG

Android supports images in which formats?

PNG, JPEG, BMP, WEBP, and GIF formats.

Which lifecycle state in which an activity in the foreground has the focus, but the fragment is still visible?

Paused

What class do you call to create a Map shape

PolygonOptions

Create a polyline on your map called mMap, with three points TORONTO_P1,TORONTO_P2,TORONTO_P3

PolygonOptions rectOptions = new PolygonOptions() .add(TORONTO_P1) .add(TORONTO_P2) .add(TORONTO_P3); Polygon polyline = mMap.addPolygon(rectOptions);

Which fragment subclass shows a hierarchy of Preference objects as lists? These preferences will automatically save to _______________ as the user interacts with them.

PreferenceFragment, SharedPreferences

declare a print writer that uses an instance of a socket named "socket"

PrintWriter out = new SocketUtils.getSocket(socket)

______ based scenarios let the user determine the interaction: get directions, find a shop, etc

Pull

_______ based scenarios let the service prompt the user: proximity based sending of adverts and coupons

Push

Write code to make a String ResponseHandler

ResponseHandler<String> handler = new BasicResponseHandler();

Write code to make a String ResponseHandler called "handler"

ResponseHandler<String> handler = new BasicResponseHandler();

In which lifecycle state is the fragment visible in the running activity?

Resumed

What is the database that Android comes with built-in?

SQLite

The recommended method to create a new SQLite database is to create a subclass of __________________ and override the __________________ method, in which you can execute a SQLite command to create tables in the database.

SQLiteOpenHelper, onCreate()

Name three features supported in Google Maps Navigation for Android 2.0

Search in plain English Search by voice Traffic view Search along route Satellite view Street View Car dock mode

Which server communication class lets you do general-purpose network programming?

Socket Class

Name 4 ways you can communicate with a server

Socket class, HttpClient, HttpURLConnection, JSONObject

declare a new instance of a socket

Socket socket = new Socket(host, port);

What are the two location types?

Spatial term Text description

Which helper class Reads status line and breaks it into three parts: HTTP version, status code, and message

StatusLineParser

Which lifecycle state in which the fragment is not visible?

Stopped

Call client.execute on client

String content = client.execute(httpget, handler);

What is a more powerful (not the most powerful) method to parse a request?

String.split with regular expressions

What is the simplest method to parse a request?

StringTokenizer

What are the three data types supported by SQLite?

Text, Integer, Real

True or False: A fragment has its own lifecycle.

True

True or False: Android has a builtin class (JSONObject) that will bothbuild and parse strings representing JSON

True

True or False: Apps that use the internet must ask for the user's permission

True

True or False: Layout can be inflated/implemented in onCreateView()

True

True or False: SQLite performs no validation to ensure the types written to the columns are actually of the defined type

True

True or False: SQLite supports all relational database features

True

True or False: getReadableDatabase() and getWritableDatabase() return the same object type

True

True or False: properties that are derived from other properties willbe inconsistent on client if other properties are changed

True

True or False: when using String.split method unless you use "+", an empty string is returned between delimiters

True

True or False: you can't create PrintStream (of System.out) for different Unicode characters sets

True

True or False: when Activity pauses, its Fragments are paused as well

True. Fragment lifecycle interacts with containing Activity lifecycle

The _________ class can parse a URL and extract its components

URL

What is the property name for getURL?

URL

Write code to get a connection from a URL "http://www.google.com"

URL url = new URL("http://www.google.com"); HTTPUrlConnection connect = (HTTPUrlConnection).url.openConnection();

What kind of exception is thrown If host passed to Socket constructor is not known to DNSserver

UnknownHostException

Attach POST data using UrlEncodedFormEntity to post name/value pair list "params"

UrlEncodedFormEntity entity = new UrlEncodedFormEntity (params, "UTF -8"); httpPost.setEntity(entity);

Which helper class Breaks a URL like http://host:port/path into the host, port, and path parts. Uses 80 if no port specified.

UrlParser

What is the most powerful method to parse a request?

Use pattern and full regex library

What are the different levels of logcat logging?

V — Verbose (lowest priority) D — Debug I — Info W — Warning E — Error F — Fatal S — Silent (highest priority, on which nothing is ever printed)

At any time while your activity is running, you can add/remove/replace fragments to your activity layout. You simply need to specify a __________ in which to place the fragment.

ViewGroup

Which Fragment subclass is a fragment that displays a WebView?

WebViewFragment

When is a readOnly db object returned by the getReadableDatabase() method?

When some problem is encountered such as full diskspace

What is the property name for getZIP?

ZIP

term ______ describes meters above sea level

altitude

The _________________ package provides an interface to individual camera devices connected to an Android device. It replaces the deprecated Camera class.

android.hardware.camera2

To use Logcat first import ___________________ in your project

android.util.Log

RFC 4627 says JSON should have ______________________ type

application/json

We can add a _______________ to tell Android to halt executing and tell us all he knows about the current state of the application

breakpoint

Name three shapes that can be used to identify sections of a Google map

circle, polyline, polygon

You can also see how many tokens are remaining with ______________

countTokens()

What method do you call when you want to terminate your connection to a URL?

disconnect()

You can reposition a marker on a map as long as its _______ property is set to "true"

draggable

What is the property name for isExecutive?

executive

What will "foobar".split("ob") return?

fo and ar

foobar".split("bo") returns?

foobar

A____________ is usually used as part of an activity's user interface and contributes its own layout to the activity.

fragment

Which Accessor Returns double associated with name?

getDouble(propertyName)

Which Accessor returns JSONArray (not native Java array!) associated with name?

getJSONArray(propertyName)

Which Accessor returns Object associated with name?

getString(propertyName)

Test if the number of tokens remaining is nonzero with?

hasMoreTokens()

Write code to use httpClient to get entire content ofaddress as a single String

httpUtils.urlContent(address);

term ______ describes 0-90 degrees north or south of the equator

latitude

Events are managed through the ______ mechanism

listener

_________ is a nice and quick way to exchange information from the application on your device and the development computer

logcat

term ______ describes 0-180 degrees east or west of the prime meridian, which passes through Greenwich, England

longitute

How would you change a marker called "marker" to be green?

marker.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN));

getProtocol, getHost, getPort, getFile, getRef are all examples of?

methods that can return the different components of the URL

Write code to take a bean and builds JSON based on bean properties.

new JSONObject(bean);

Write code to read a JSON string and builds JSONObject from it.

new JSONObject(json String);

Write code to take a Map and builds JSON from it.

new JSONObject(nameValueMap);

Retrieve tokens one at a time with _____________________

nextToken()

If the connection is terminated, what does readLine return?

null

Which Fragment LifeCycle Callback in which fragment's activity is created and view hierarchy instantiated?

onActivityCreated()

The Android Camera application encodes the photo in the return Intent delivered to ____________ as a small _________ in the extras, under the key "data".

onActivityResult(), Bitmap

Which Fragment LifeCycle Callback in which fragment is first attached to its Activity?

onAttach()

Which Fragment LifeCycle Callback for the initial creation of a fragment?

onCreate()

One difference when creating a Fragment is that you must use the ______________ callback to define the layout. In fact, this is the only callback you need in order to get a fragment running.

onCreateView()

Which Fragment LifeCycle Callback in which fragment first instantiates its user interface view?

onCreateView()

Which Fragment LifeCycle Callback in which fragment is no longer in use?

onDestroy()

Which Fragment LifeCycle Callback in which fragment's view which was previously created by onCreateView() is detached from the fragment?

onDestroyView()

Which Fragment LifeCycle Callback in which fragment is no longer attached to its Activity

onDetach()

What listener implementing interface method do ClickEvents use for Markers

onMarkerClickListener onMarkerClick(marker)

What listener implementing interface and method do DragEvents use for Markers

onMarkerDragListener onMarkerDragEnd(marker)

Which Fragment LifeCycle Callback in which fragment is visible, but does not have focus?

onPause()

Which Fragment LifeCycle Callback in which fragment is visible to user and actively running?

onResume()

Which Fragment LifeCycle Callback in which fragment is visible?

onStart()

Which lifecycles are in common between Activity and Fragment?

onStart, onPause, onResume, onStop

Which Fragment LifeCycle Callback in which fragment is no longer visible?

onStop()

Which class establishes connection to server?

openConnection

You can use ___________________ to get a stream to the URL

openConnection

Which class gets a Stream for reading data? It can be wrapped in InputStreamReader (usually buffered) to use readLine

openInputStream

Write code to add a name/value pair to a list of name/value pairs called "params"

params.add(new BasicNameValuePair(paramName1, paramValue1));

What are the Fragment lifecycle states?

paused, resumed, stopped

What is the property name for getPrime or isPrime?

prime

PrintWriter, use ____., ____, _____

print, println, and printf,

What can you use for formatting requests?

printf

Which method will be used for creating and/or opening a db that will be used for reading?

public SQLiteDatabase getReadableDatabase()

Which method will be used for creating and/or opening a db that will be used for reading and writing?

public SQLiteDatabase getWritableDatabase()

For input stream, BufferedReader, call ______ to get a single char or an array of characters, or call _______ to get a whole line

read, readLine

By default, the marker color will be

red


Related study sets

Chapter 22: The Integumentary System

View Set

الفصل الثاني / حضارة بلاد الرافدين (العراق)

View Set

Chapter 13 Employment Interviewing and Follow-Up

View Set

Exemplar 28.4 Postpartum Depression

View Set

MCAT Chemical Names and Structure List

View Set

BUL3130-Lesson 04: Alternative Dispute Resolution & The Constitution

View Set