Android Development Flashcards
what makes up the ANDROID SYSTEM ARCHITECTURE?
Applications Application Framework Libraries Android Runtime Linux Kernel
What is a VIEW?
The base class create Interactive UI Components
What is the CONTENT PROVIDER?
It allows the user to access information from another application
What is the RESOURCE MANAGER?
Provides access to non-code resources such as localised strings, graphics and layouts
What is the NOTIFICATION MANAGER?
Displays custom alerts
What is the ACTIVITY MANAGER?
This manages the lifecycle of an application
What is ANDROID RUNTIME?
A java code which implements the Android Application Programming Interface for UI data access, and other platform features.
What is the LINUX KERNEL?
Operating System used by LINUX family.
What is SDK and what does it provide?
Software Developer’s Kit, and it provides the API (Application Programming Interface) libraries and developer tools
RelativeLayout: …
to specify the location of child objects relative to each other.
xmlns:android=“…”: …
to define the XML namespace to reference part of the Android SDK.
android:layout_width/height=”match_parent”:…
to make the width as wide/high as it can be within the parent.
android:paddingBottom/Left/Right/Top=“16dp”: …
to set the padding, in pixels, of the bottom/left/right/top edge.
tools:context=“com…MainActivity”:
to find the right theme based on the activity.
android:layout_width/height=“wrap_content”:
to display the item wide/high enough to enclose its content.
android:text=“…”:
to display the text.
android:id=“@+id/phone_icon” :
The id attribute defines the unique identifier for the view in the Android system.
android:layout_width=“wrap_content”:
Informs the Android system to only take up as wide as needed to show the view.
android:layout_height=“wrap_content”:
Informs the Android system to only take up as high as needed to show the view.
android:layout_gravity:
This defines how to place the view, both its x- and y-axis, with its parent.
android:src=“@drawable/phone_on”:
This is a direct child of the ImageView class. One can use this to set the image that they wish to see on the screen.
What are Event Listeners:
This is an object that receives notification when an event happens, using the View class to build up an Android GUI.
What is Event Listeners Registration:
This is a process by which an Event Handler is registered with an Event Listener.
What are Event Handlers:
A method to handle the event.
i.e. onClick(), onTouch(), onMenuItemClick()
How would one link a Java Button reference (sButton) to an XML Button(button_1)?
Button sButton = (Button) findViewById(R.id.button_1);
What is an Activity?
A single focused thing a user can create, application can consist of many. Each Activity is implemented as an implementation of the Activity Base Case
What are the possible Stages of an activity?
On Create() On Start() On Resume() On Pause() On Stop() On Destroy() On Restart()
What does the Bundle SavedInstanceState() do?
Gives the developer a way to pass information back and forth between screens what is known as a bundle
What does the super.onCreate(savedInstanceState)() do?
Calls to the base Activity class to perform setup work to build the MainActivity Class
What does the setContentView(R.layout.activity_main) do?
Referes to the activity_main.xml file that is located in the res/layouts directory.
What is a sensor in Android Application?
A built-in component that measures motion, orientation and various environmental conditions
i.e. motion/position/environmental
Which Sensors are hardware dependent?
Accelerometer Ambient Temperature Gyroscope Light Magnetic Field Linear_Acceleration Gravity
Which Sensors are software dependent?
Orientation
Linear_Acceleration
Gravity
What is the Sensor Manager Class?
You can use this class to create an instance of the sensor service. This class provides various methods for accessing and listing sensors, registering and unregistering sensor event listeners, and acquiring orientation information. This class also provides several sensor constants that are used to report sensor accuracy, set data acquisition rates, and calibrate sensors.
What is the Sensor Class?
You can use this class to create an instance of a specific sensor. This class provides various methods that let you determine a sensor’s capabilities.
What is the SensorEvent Class?
The system uses this class to create a sensor event object, which provides information about a sensor event. A sensor event object includes the following information: the raw sensor data, the type of sensor that generated the event, the accuracy of the data, and the timestamp for the event.
What is the Sensor Event Listener?
You can use this interface to create two callback methods that receive notifications (sensor events) when sensor values change or when sensor accuracy changes.
What does the below code snippet achieve:
private SensorManager mSensorManager;
…
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
To identify a sensor, we first need to get a reference to the sensor service. We create an instance of the SensorManager class by calling the getSystemService() method and passing the SENSOR_SERVICE argument.
What does the below code snippet achieve:
List deviceSensors = mSensorManager.getSensorList(Sensor.TYPE_ALL);
Gets a list of all sensors on a device calling the getSensorList() method and using the TYPE_ALL constant.
We can use another constant to list all the sensors on the device such as TYPE_GYROSCOPE, TYPE_LINEAR_ACCELERATION or TYPE_GRAVITY.
How would one determine if a given sensor i.e. light? exists on a device?
GetDefaultSensor(SENSOR.TYPE_LIGHT);
Name two SensorEventListener CallBack Methods?
onAccuracyChanged() (low/med/high/unreliable)
onSensorChanged()
When calling a sensor, a SensorEventListener is registered, if the accuracy changes, the listener will be informed. To conserve battery it is registered onResume() and Unregistered onStop().
What are possible options for data storage in an android application?
Shared Preferences - Stored as key value pairs Internal Storage of local device External Storage device, i.e. men-card SQLite Database Network Remote Connection
What is the FileInputStream Class used for?
Reading Streams of Raw Bytes from a File
What method is called to read a file from the FileInputStream Class?
openFileInput(fileName);
What is the FileOutputStream Class used for?
Writing Streams of Raw Bytes from a File
In order to Write the data to a file, one calls what method from the FileOutputStream Class?
openFileOutput(fileName, MODE-WORLD_READABLE)
What is SQLite?
An open source database; SQLite supports standard relational database features SQL syntax and statements. Database requires very little memory at runTime. Embedded in Android
Where would one find all necessary Database Classes
android.database package
Where would one find all necessary SQLite Classes
android.database.sqlite package
Which base class has methods to create, delete and execute SQL commands as well as other database management functionality i.e. query(), rawQuery()…
SQLiteOpenHelper Class This class is responsible for reading the database.
What is a DAO (Data Access Object)?
DAO’s manage data for android applications; responsible for handling the database connection and for accessing/modifying the data. DAO’s will also convert database objects into real Java Objects so that our user interface code does not have to deal with the persistent layer.
What function does the onUpdate() perform within the SQLite Helper Class?
Deletes all existing data and recreates the table.
What is the function of the comment Class?
This class contains the data that users will ‘save’ in the database and show in the UI
What permissions are needed for Google Maps API in Android?
Access Network State Internet Write External Storage Access Coarse Location Access Fine Location
What XML property is the Google Maps API stored in?
Fragment
What is a FRAGMENT?
A Behaviour/portion of the UI. Allows the user to modify the activity’s appearance at runtime whilst preserving changes made by the activity.