CSCI 4060 (Mobile Dev) Final
What type of Layout Panes exists in Android Studio?
- BorderPane: children are in top, left, right, bottom, and center areas - VBox - HBox - Stack - GridPane - TilePane - FlowPane
Describe Android System Licensing
- Developers and device manufacturers pay no royalties or license fees - Licensed under GNU General Public License Vers. 2 (GPLv2) - Framework distributed under Apache Software License - No need for developers to provide improvements to the open-source community
Characteristics of Android Runtime (ART)
- Each app runs in its own virtual machine (VM) in a separate process - Uses Dalvik byte code - Dalvik VM used to run apps until Android 5.0 - ART replaced Dalvik
Why Android development may be more appealing?
- Familiar programming languages (java) - Cheaper developer license - Widely available development environment - More liberated app store - Android has a large install base (world-wide)
Alternatives to Android Studio /Java
- Flutter (by Google); programming in Dart - React Native (b Facebook); programming mostly in JavaScript, CSS, HTML - Xamarin - Codename One - Cordova
Characteristics of Linux Operating System
- Handles core system services - Act as hardware abstraction layer (HAL) - Enforcement of application permissions and security - Low-level memory management - process management and threading - network stack - Display, keypad input, cam, wifi, flash memory, audio, binder, and power-management driver access
Components of Android Studio
- SDK tools - Platform tools - SDK Build Tools - The latest Android System image for the emulators - Google APIs - Android emulator - Gradle - Java Compiler
1 dp is how many inches?
1/160 of an inch. this fixes the absolute size of one pixel on a screen
When DPI = 160 and the size is 32dp what is the px?
32 px
When DPI = 320 and the size is 32dp what is the px?
64 px
What is the function of a checkbox?
A button with 2 states -- checked and unchecked
What is the function of a ToggleButton?
A button with two states, but used to show the state visually
What is a control (GUI)?
A control is a screen element that displays information or allows the user to interact with the program ex: labels, buttons, text fields, sliders, etc.
the view class is the basic user interface building block within android What does it represent?
A rectangular portion of the screen, usually with some contents inside
Android keeps track of all activities currently running by placing them on what?
Activity Stack
What is a event (GUI)?
An object that represents some activity to which we may want to respond. ex: a graphical button is pressed
What is a event handler (GUI)?
An object to respond to an event when it occurs. Design event handlers to take whatever actions are appropriate when an event occurs.
Latest official version of Android
Android 13 - Tiramisu
List of recent Android Systems
Android Pie (last version with sweet name) Android 10 - Quince Tart Android 11 - Red Velvet Cake Android 12 - Snow Cone Android 13 - Tiramisu* Android 14 - Upside Down Cake
What is Android Studio?
Android Studio is the IDE used to develop android apps. It allows cross-platform development.
Once the activity is fully functioning, it is place on top of what?
Android's activity stack
What is the java package that contain several interfaces and classes related to drawing components and widgets on the screen?
Android.view
JavaFX programs extend the ____ class, inheriting core ____functionality.
Application, Graphical
What is another term for activity stack?
Back stack
What is an event-handlers?
Code fragments that are invoked in response to events.
What is a popular layout type?
ConstraintLayout
In Java GUI is created with at least three kinds of objects:
Controls, events and event handlers
When was Android Inc acquired and who is created it?
Created Andy Rubin , Acquired by Google in 2005 Google provided initial code
Why do we use DP?
DP is used to provide a consistent user interface across different devices with varying screen densities.
Sizes in android are often specified in what kind of unit?
DP unit; density-independent pixels or device-independent pixels. it is a resolution-independent unit
What does the LinearLayout control do?
Draws its child controls in a single horizontal row or a single vertical column
What are two frequently used controls to handle text input?
EditText and Spinner
What is the code to read data from EditText?
EditText et = findViewById(R.id.editText1) String name = et.getText().toString
What were Android's first "killer" apps?
Email, Web Browser, Google Play store (android market)
T/F - A dot is the same on every screen.
False; a dot/pixel size can vary from screen to screen
T/F - you will want to access and modify all layout resources.
False; some interface controls are static and you don't need to work with them programmatically. Others you'll want to be able to access and modify in your Java code
What is a GUI?
Graphical User Interface
When the new activity finishes what happens to it?
It is removed from the activity stack and the previous Activity in the stack resumes
What is the purpose of the R.java class?
It is the bridge between the app's compiled code and the resources it needs to access. Using this class can help developers easily access the app resources from within their java code
What is is happening when an android app preforms setup?
Layout creation and data initialization
2 major components of Android's Architecture
Linux Operating System and Android Runtime (ART)
Log function to show debug messages
Log.d()
Log function to show error messages
Log.e()
What is the second step to code debugging tags?
Log.i( DEBUG_TAG, "MainActivity.onCreate()"
Log function to show info messages
Log.i()
Log function to show verbose messages
Log.v()
Log function to show warning messages
Log.w()
Common Google APIs for Google services
Maps, Places, Firebase, Google Sign-in
How many apps are usually executing at a given time?
Only one, and others are in the backgrounfd
How many active apps can be visible to the user at a time?
Only one, because there is no split screen (foreground)
Traditionally, sizes of graphical elements on a digital screen are measured in what?
Pixels
What does the ConstraintLayout do?
Positioning of the child control is defined/constrained in terms of constraints w.r.t. the parent or the other controls within the layout
What is the function of a RadioButton?
Provides an exclusive selection of an item out of a group
Font sizes in android are measured in what units?
SP units (scale-independent pixel)
What is procedure driven system?
Software control always resides in procedures in user code Procedures call each other and control is passed from the caller to the called procedure. Caller is blocked until the called procedure exists. Procedures direct the control flow.
What is an event-dispatcher?
Software control that resides in a piece of code. Runs a continuous which accepts events and invokes the associated event-handlers.
What control gives users a set list of options?
Spinner control; best when able to provide a limit of valid states/options for the user
A simple game may have the following activities:
Startup Screen, Main menu screen, game play screen, high score screen, help screen
What is one of the most common types of data that applications often need to collect from users?
Text!
When a new activity starts, what happens to the activity on the top of the stack?
The activity is stopped, and the new activity is pushed onto the top of the stack
T/F - You should only test on an emulator when developing for Android
The emulator is indispensable, but should not be used as a replacement for testing on actual target devices
How can you make a toast message programmatically?
Toast.makeText(ButtonsActivity.this, "Button clicked", Toast.LENGTH_SHORT).show();
What is logging useful for?
Tracing and debugging and learning Android Lifecycle
T/F - An android app usually included multiple activities.
True
T/F - can anyone fork the OS source code
True, Android is an Open-source project
T/F - android allow multiple apps to run concurrently
True, provided memory and processing power are available
T/F - Is nesting of layouts useful?
True; it provides great flexibility but is considered sub-optimal! *Better practice to use ConstraintLayout
What is the first step to code debugging tags?
Type the message: private static final String DEBUG_TAG = "Go Dawgs"
An activity typically includes what
UI components or widgets and the users interact with the app using these components and widgets
What is the function of a button?
Used to perform some sort of action
the onCreate() method is an event handler, but is also referred to as what?
a callback
Describe an Android Activity
a single screen/window for users to interact with an application, similar to a window in a JavaFX GUI program
What is a Toast Meessage?
a small pop-up message that appears on the screen
What is an event-driven system?
a software system which is designed around responding to various events. Events drive the computation Events ex: key pressed on keyboard, mouse pointer movements, an arrival of a message, or timer clock running out.
What is a layout?
a way to arrange controls (nodes( within a scene (scene graph)
What does the start method do in JavaFX?
accepts the primary stage (window) used by the program as a parameter. The scene is displayed on the primary sStage
What package contain common objects like textview, edittext, button, and imageview?
android.widget
An example of how to give a list of options for Spinner programmatically?
android:entries="@array/colors"
Common XML Attributes for EditText
android:hint="enter hint" android:lines= "4"
Common XML Attributes for ImageView
android:paddingLeft="40dp" android:scaleType="fitcenter"
Common XML Attributes for TextView
android:text= "enter text" android:autoLink= "web|email" android:ems= "12"
Common XML Attributes for Button
android:text="Basic Button" android:src="@drawable/droid" *for imagebutton
What is the XML line to change the text on a layout?
android:text="enter text here"
What does the TableLayout control do?
displays each child control in tabular format (rows and columns)
What is DPI?
dot per inch; a screen has a specific pixel density
The width of Texview can be in terms of what instead of pixels?
em; a term used in typography that is defined in terms of the point size of a particular font
Finish the code to access a textview control names TextView1: TextView tv = [ ? ]
findViewById(R.id.TextView1);
What is the Log import statement?
import android.util.log
Physical screen sizes are measures in what?
inches or millimeters
How many parameters does onCreate() have?
it had 1 parameter called a bundle.
Example of constraints:
layout_contraintTop_toTopOf layout_constraintBottom_toTopOf
What is bundle for a newly started activity?
null
How does android initialize the app lifecycle on start (when tapping on the icon)?
onCreate()
What is the callback sequence for starting an activity/app?
onCreate() onStart() onResume() this activity is running in the foreground.
What is the callback sequence for killing an activity/app?
onPause() onStop() onDestroy() the activity is killed
What is the callback sequence for stopping an activity/app (ie for a call)?
onPause() onStop() this activity is in the background
What is the callback sequence for resuming an activity/app (ie after a call)?
onRestart() onStart() onResume() this activity is back in the foreground
What is an example for a method that can be called inside onCreate() for setup?
setContentView()
Applications are be interrupted and ____ when events such as phone calls occurs
stopped
Each control to be accessed ....
usually has a unique identifier, specified using the android:id attribute.