0% found this document useful (0 votes)
18 views42 pages

Android Studio Environment Overview

The document provides an overview of the Android OS architecture, detailing its four main layers: Applications, Application Framework, Libraries, and Linux Kernel. It explains key components of the Android environment, including Activities, Services, Content Providers, and Broadcast Receivers, as well as tools like Android Studio, Gradle, and the Android Manifest. Additionally, it covers layout management, XML usage, and the Android Virtual Device Manager for testing applications.

Uploaded by

Kalab Mitku
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views42 pages

Android Studio Environment Overview

The document provides an overview of the Android OS architecture, detailing its four main layers: Applications, Application Framework, Libraries, and Linux Kernel. It explains key components of the Android environment, including Activities, Services, Content Providers, and Broadcast Receivers, as well as tools like Android Studio, Gradle, and the Android Manifest. Additionally, it covers layout management, XML usage, and the Android Virtual Device Manager for testing applications.

Uploaded by

Kalab Mitku
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Android Studio

Understanding the Environment and related concepts


Outline
➔ Android OS architecture
➔ The android environment and concepts
Android OS architecture
● Android OS is a stack of software components roughly divided into 4
sections
○ Applications
○ Applications framework
○ Libraries
○ Linux Kernel
The Applications layer
• The Applications layer is where user-facing applications reside,
such as social media apps, games, and productivity tools.
The Application Framework
• The Application Framework layer provides a set of Java-based APIs
that allow developers to build applications and access
various system services.
The Libraries layer
• The Libraries layer includes essential libraries that provide
additional functionalities to Android applications, such as
graphics rendering, database management, and network
communication.
The Linux Kernel
• The Linux Kernel, which provides low-level hardware
abstraction, drivers, and security features.
• The Linux Kernel interacts directly with the device's hardware,
managing processes, memory, and device drivers.
ART (Android Runtime)
● ART is the runtime environment used by Android to execute
applications.
● It replaced the earlier Dalvik runtime in Android 4.4 and higher
versions.

● ART is responsible for converting the application's bytecode into


machine code that can be directly executed by the device's
processor.

● It also handles memory management, garbage collection, and


other runtime tasks.
HAL (Hardware Abstraction Layer)

● Hardware Abstraction Layer (HAL) acts as an interface between


the Android operating system and the device's hardware
components.

● Its primary purpose is to provide a standardized set of APIs that


allow the Android framework to communicate with and control
hardware devices.

● The HAL abstracts the hardware details, making it easier for


developers and manufacturers to write hardware-independent code
that can work across various Android devices.
Key android environment
and concepts
Top level components
● 4 top level components provide the ability to do everything
○ Activity
■ Can be a single screen of an app, handles UI and events
○ Service
■ Works in the background, has no UI
○ Content provider
■ Responsible to share data for apps
○ Broadcast receiver
■ Responds to system wide events in real time
Activity
● It presents the content users interact with on the screen
● Represents something an application can do
● An application can have more than 1 activities
Android views
● Views occupy rectangular area on the screen
● Responsible for drawing and event handling
● Can display images , text, etc
● Combination of views forms the design interface
Android Layout files
● Each android application layout is represented by an XML file
● The XML file serves as a blueprint for the interface of an application
● Views can also be created using java or kotlin
● Jetpack compose – can also be used to create user interfaces using
kotlin code only
XML
● Stands for Extended markup language
● Is used to develop apps user interface
● The whole structure is built on tags
HTML vs XML

HTML XML

● Designed to display data ● Designed to carry data with


with focus on how data focus on what data is
looks ● Tags are not predefined
● Tags are predefined
XML syntax
● Xml document must have a root element
<root>
<child>
<subchild> ….. </subchild>
</child>
</root>
Android Virtual Device ( AVD )Manager
● AVD manager optimizes android apps for different devices
● Helps to test apps
● Lets us create and configure virtual devices
● Running virtual device requires – virtualization tool for hardware
acceleration to be enabled i.e. Hyper-V
○ Windows 10 is preloaded with this feature
● If Hyper-V is not enabled – HAXM hardware acceleration tool will be
downloaded together with an Emulator
Emulator
● It is a computer program that imitates real device
● To use it – you need to download it first
● Used for testing our app
● Requires high computing resources
○ Disk space
○ RAM
● Examples
○ Bluestacks
○ [Link]
Gradle
● A.k.a android build system
● Android applications might contain hundreds or thousands of files
and resources
● These files need to be packed as a single file in a way android
device can understand, this is where Gradle comes in.
● Gradle packages everything together in a compressed file
known as APK, android package kit.
● It simplifies the process of managing complex dependencies and
automates tasks such as compiling source code, packaging
resources, and generating the final APK.
R class
● The "R" class is an automatically generated class that acts as a
resource manager in Android projects.
● It contains references to various types of resources, such as
layouts, strings, colors, drawables, dimensions, and more.
● These resources are typically defined in XML files within the
project's "res" directory.
● When you build an Android project, the Android build system
generates the "R" class based on the resources you have
defined.
Android Studio project structure
● .gradle
○ Contains configurations and files used for project building
○ Auto generated
● .idea
○ Contains metadata of project
● App
○ Contains project source code
● Gradle( androids build system )
○ .gitignore -- specify sensitive files and folders
○ build-gradle -- specify and manage configuration options
○ gradlew -- created whenever a new feature is required
○ local-properties -- local configuration info
○ [Link] -- handles settings for projects and modules
…cont’d …
● MainActivity
○ Generated when a project is created
○ Activity class contains a layout
○ onCreate() function must be in your activity class to run an android app
Res folder
● Contains the following
○ Drawable
○ Mipmap
○ Layout
○ values
● Both drawable and mipmap store image assets
● Mipmap
○ renders high quality images across different devices
○ It is an upgrade and preferable
○ Images will not become blurry
○ Uses webp images file format ( extension )
Android Manifest
● Used as configuration file to define what an app requires to run
● Helps to define permissions
● e.g sendSMS
<uses-permission android-name=“[Link].SEND_SMS”>
Layout folder
● Used to manage UI
● Contains the xml files of your app
Layout inflation process
● During project creation, android studio associates the layout file
(xml) with the MainActivity (java) object.
● The two are associated by, a method called – setContentView( )
● This complex method accepts the layout resource file identifier ,
generates the views designed within , and presents them on screen
– a process known as layout inflation.
Android Logcat
● Adding messages to a log can be a
useful way of checking that your code
works the way you want.
● Each message is composed of a
String tag you use to identify the
source of the message, and the
message itself.
Android SDK version
● The minimum required sdk is the lowest version your app will
support.
● Your app will run on devices with this level API or higher.
Dimensions
● Defined in XML
● Specified with a number followed by a unit of measure
● Example : 5sp, 15dp, 12px
● The following unit of measure are supported in android
○ dp (density independent pixel) – for margin, padding, etc.
○ sp (space independent pixel) – for font size
○ pt (point)
○ px (pixel)
○ mm (milimmeter)
○ in (inch)
Android densities
● There are a lot of Android devices with different sizes and
proportions and each screen has its density.
● Android densities can be:
○ ldpi (low) ~120dpi
○ mdpi (medium) ~160dpi
○ hdpi (high) ~240dpi
○ xhdpi (extra-high) ~320dpi
○ xxhdpi (extra-extra-high) ~480dpi
○ xxxhdpi (extra-extra-extra-high) ~640dpi
Android densities
● DPI stands for dots per inch.
● Thanks to dp the UI elements look uniform on screens with different
densities.
…cont’d
Layouts
● Relative Layouts
○ is a layout which arranges views/widgets/viewGroup according
to the position of other views/widgets/viewGroups i.e the new
views are placed relative to the already existing views
○ Most commonly used layout type
…cont’d
…cont’d
…cont’d
…cont’d
Linear Layout
● Arranges elements either in
○ Horizontal orientation (default) - Left to Right
○ Vertical orientation – Top to Bottom
Exercise – Match A to B
Column A Column B
● Converts bytecode to 0’s and 1’s ● ART
● Interface b/n Android OS and the android ● HAL
hardware ● Gradle
● Loading libraries, building APK
● R class
● Auto generated resource manager

● Mipmap
Contains App launcher icons
● Glues layout and java file together ● setContentView( )
● Arranges views/view groups left to right ● Linear Layout
or top to bottom ● Relative Layout
● Single screen of an App ● Android Manifest
● Lists Application Permissions ● Activity / ActivityCompat
● Contains metadata of android project
● The idea folder

You might also like