Mobile Application Development - Android - 3660 Final
SharedPreferences (in context of persisting data)
API SharedPreferences allows to save a set of key-values in the application data folder. Generally used to save small collections/personal preferences. Resulting file is an XML file saved within app folder.
Core components of an android app
Activities Intents Services
Explain how the lifecycle of an android activity works
Activity is launched (onCreate, onStart, onResume come after). Activity is running (onPause, onStop, onDestroy come after). After onStop, process returns to onCreate which is after activity is launched. Activity is shutdown.
RelativeLayout
All elements can be displayed in relation to other elements or to its parent in this layout
ConstraintLayout
Allows you to create large and complex layouts with a flat view hierarchy (no nested view groups). Its similar to relativelayout in that all view are laid out according to relationships between sibling views and parent layout, but its more flexible than relativelayout and easier to use with the layout editor.
values (res)
Different type of values are included within this folder (strings, integers, arrays)
TableLayout
Displays elements as in a traditional table with rows and columns. It extends from LinearLayout
Manifest file and how is it used
Every android app has this in its root directory named <AndroidManifest.xml>. File includes info about app, including the java package name for the app
Linux Kernel
Base layer of an application that directly interfaces with the device hardware - level that deals with hardware drivers like the camera, keypad, and display
drawable (res)
Bitmap files or XML defining images for different states
SQL Database (in context of persisting data)
Can use SQLite databases to store structured data, or info that is more complex than a key-value set.
What is a service in android
Component that serves a long-running operation in the background and does not have an interface. Services are started by other application components and remain in the background whether the other component remains active or not. Similar to activities and fragments, services have their own lifecycle
Three common android layouts
ConstraintLayout RelativeLayout TableLayout
layout (res)
Folder defining layout files
Explain how the lifecycle of fragments differ from activities
Fragments have their own lifecycle and is somewhat similar to activity lifecycles. Fragments are attached to activities and therefore also depend on them (if an activity dies, so does the fragment). As opposed to activities, several fragments can be in a running state at once.
Intent
Frequently used to link activities and launch new activities
Unbound Service
Has been started with the onStartCommand() function and are unbound from any other component. They will keep running indefinitely even if the component is destroyed.
Bound Service
Is connected to other components and typically lives while the other component is still alive. By calling the functions bindService() or unbindService() the service will be bound/unbound from the component
com.example.name.myapplication
Java files are kept here
What are the 5 components of the android architecture?
Linux Kernel Native Libraries Android Runtime Application Framework Applications
BottomNavigation UI
Persistent bar at the bottom of the screen that can have navigation buttons (back, home, recents, favorites, etc)
Services
Provides long running operations in the background
Android Runtime
The Dalvik Virtual Machine is in the same level as the native libraries and allows every android app to run its own processes
Gradle Scripts
The gradle is used to to build the application at runtime
Files (in context of persisting data)
Used to handle large amounts of data (image files). These files can be saved in the internal storage (accessible from the current application) or in the external storage (accessible from the entire system).
raw (res)
Used to include arbitrary files that cannot be classified in the other categories
What are the seven lifecycle methods of an android activity and what is their purpose?
onCreate(), onDestroy(), onStart(), onRestart(), onStop(), onPause(), onResume(). Their purpose is to help structure android code around how an activity to perform throughout its lifecycle on the device
What is an android layout?
A representation of a UI component and can be contained in items such as a fragment or a widget. A layout can either be defined in an XML file or it can be instantiated at runtime
Benefits of Material design
A unified set of guidelines that combine attractive colors with sensible aesthetics that a majority of users would enjoy. There are reasons to not follow it; its up to the developers intentions
What is a res folder and what is it used for?
Resources are additional content (images or strings) that are packed and delivered with the application. An application can access and use these files in its own context. There are different types of folders, each one includes different type of resources. Some subfolders under res are drawable, layout, raw, values.
Native Libraries
Resting on top of the linux kernel are a set of open-source libraries including the SQLite database and the webkit browser engine
Ways to persist data in android
SharedPreferences SQL database Files
Application Framework
The next layer up provides higher-level services in the form of java classes to applications on the device. The key services to know are the activity manager, content providers, resource manager, notifications manager, and the view system
NavigationDrawer UI
This is a panel that slides out from the left side of the screen and can have different buttons that can have intents that lead to new activities
Applications
Top layer is the android app itself. This is the level where applications are actually installed, and the one developers are most familiar with
Activity
Window that the user can interact with