Basic Components of an Android Application Flashcards
List the fields set when creating a new Android Application
– The project’s name
– The package’s name
– The project folder’s location
– Language of use (either Java or Kotlin)
– The minimum SDK version
What is the importance of a minimum SDK version
It will determine the number of devices the application will be deployed on and also the minimum version for that an application can be deployed on)
What files are under the Apps folder
– MainActivity
– Layout files
– AndroidManifest.xml
– Gradle Scripts
Describe the Main Activity and where it is found
● This is the entry point of any given application.
● It is found under the main package name assigned during project creation, which in turn
sits in the java subfolder
Where are other activities created
– Other activities are usually created under the same level as the MainActivity.
– Depending on a project’s structure, different activities can fall under different packages, which fall under the java subfolder.
How are Layouts defined in mobile dev. What is the initial layout?
● The layout subfolder, which falls under the res subfolder, contains XML files that define the various activities’ UIs.
● By default, the initial layout created is the activity_main.xml which defines the layout of the main activity.
Describe the AndroidManifest.xml file and its importance
● This sits under the manifests subfolder.
● By default, when using Android Studio, this file is
automatically generated, and is always named as AndroidManifest.xml.
● It is an important Android file that describes the fundamental
characteristics of an app and defines each of the app’s
components, providing this info to Android build tools, OS, and Google Play.
● Any component in the application must be declared in the AndroidManifest.xml file, failure to which it will not be started by the application.
What are the key elements declared in the AndroidManifest.xml and in which format are they declared
– App components: Activities, services, broadcast receivers, and content providers
– App permissions
– Hardware and software features the app requires
● Due to it’s format as a markup language, the elements in an AndroidManifest.xml must be
declared as (enclosed in) tags.
What are the App components that are declared in the manifest
– <activity> for each subclass of Activity.
– <service> for each subclass of Service.
– <receiver> for each subclass of BroadcastReceiver.
– <provider> for each subclass of ContentProvider.</provider></receiver></service></activity>
What are attributes in components and give examples
Within each component, the relevant characteristics
must be declared under various attributes.
Examples:
-The name attribute is used to identify a component.
-Intent filters
-Icons and labels
Describe Intent filters and define an intent
– App components are activated by intents.
– An intent is a message defined by an Intent object that describes an action to perform, including the data to be
acted upon, the category of component that should
perform the action, and any other instructions.
– An app component can have a number of intent filters
declared.
*See slide 13
Describe Icons and labels:
– When declared within elements, these display small
icons and labels for users in the corresponding app components
Why do android apps need maps
Android apps must request permissions to access
sensitive user data, eg, contacts, location, SMS, other apps, etc.
How are permissions defined and handled in android development
Each permission is identified by a unique label representing the specific request.
● Each permission is placed inside a <usespermission> tag.
● Any new user-defined permission for an app must
be declared using the <permission> tag.</permission></usespermission>
What are the tags used to declare H//W and S/W features in the manifest. What is the importance of this declaration
● Key tags for this include:
– <usesfeature>: declares h/w and s/w features and app needs
– <usessdk>: declares minimum version an app will be compatible with.
This ensures that only compatible devices are able to install and run the applications.