IT 307 Unit 1.3-Unit3 Midterms PDF

Document Details

Uploaded by Deleted User

Tags

Android architecture Android development mobile operating systems computer science

Summary

This document covers the Android architecture and components. It details the layers involved in Android, including crucial elements like the Linux kernel, libraries, and the application framework. The document also offers examples and explanations of key functions in the Android system, making it a valuable resource for understanding and learning about Android development.

Full Transcript

​ Power Management: Manages UNIT 1.3: ANDROID ARCHITECTURE AND battery power, critical for mobile COMPONENTS devices. ​ Pro...

​ Power Management: Manages UNIT 1.3: ANDROID ARCHITECTURE AND battery power, critical for mobile COMPONENTS devices. ​ Process Management: Oversees Introduction: multitasking by managing system Android processes, ensuring apps run ​ versatile, open-source operating system smoothly. based on the Linux kernel, primarily used in mobile devices. Examples ​ Understanding its architecture is crucial for ​ Device Drivers: Include drivers for developers aiming to build efficient, display, audio, camera, Bluetooth, high-performing applications. and sensors, facilitating ​ The architecture is composed of distinct communication between hardware layers, each serving specific functions that and software. support the operating system and ​ Security Modules: The kernel applications. manages access control, permissions, and data encryption, Android Layer Architecture vital for protecting user data. ​ built in a stack of layers, each providing specific services to the layers above it. ​ Libraries and Android Runtime (ART) ​ ensures modularity Libraries ○​ allowing developers to focus on ​ Set of C/C++ libraries that provide specific parts without needing to basic functions like data storage, interact directly with the underlying web rendering, and media playback. hardware ​ These libraries are crucial as they ​ Key Layers are: offer the functionalities that apps ○​ Linux Kernel use for advanced operations. ○​ Libraries and Android Runtime (ART) ○​ Application Framework Key Libraries ○​ Applications ​ Surface Manager: Manages display rendering and screen compositing, ensuring smooth transitions and animations. ​ Media Framework: Handles audio, video, and image processing, enabling multimedia features in apps. ​ SQLite: Provides a lightweight relational database engine for storing structured data within applications. ​ WebKit: Renders HTML content, allowing apps to display web pages. ​ SSL and SGL: Ensure secure internet connections and graphics rendering Library Functions Examples: Detailed Overview of Each Layer ​ SurfaceFlinger: This library handles drawing operations for apps like ​ Linux Kernel games or video players, which need ○​ The base layer of Android, rapid screen updates. ○​ derived from the Linux kernel, serves ​ OpenGL ES: Provides APIs for as the foundation of the OS. rendering 2D and 3D graphics, ○​ It handles low-level hardware widely used in gaming apps for interactions, system resources, high-quality visuals security, and core services such as memory and power management. ❖​ Android Runtime (ART): ​ Key Responsibilities ​ The environment where ​ Hardware Abstraction: Allows Android applications run. Android to interact with hardware ART replaces the older like cameras, sensors, Wi-Fi, and Dalvik Virtual Machine, Bluetooth without needing to rewrite offering improved drivers for each component. performance and efficiency. ​ Security Management: Provides a security layer, controlling access to hardware resources. Key Features: to select recipients from your ​ Ahead-of-Time (AOT) Compilation: contacts. Compiles bytecode into native ​ Location Manager: Apps like Uber machine code during installation, or Google Maps use it to provide resulting in faster app execution real-time location tracking and ​ Garbage Collection: Automatically navigation. manages memory, preventing memory leaks by reclaiming unused ​ Application Layer memory. ○​ The topmost layer where all the ​ Managed Memory Environment: user-facing applications reside. Provides an automatic memory ○​ It includes system apps, third-party allocation and deallocation process, apps installed by users, and reducing developer overhead preinstalled apps provided by the device manufacturer. ART Functions Examples: ​ Ahead-of-Time (AOT) Compilation: Key Points: Apps like social media platforms ​ Apps interact with the underlying benefit from faster launch times and framework, using APIs to perform smoother user experiences due to actions such as accessing the precompiled code. camera, sending data, or retrieving ​ Garbage Collection: Ensures information from the internet. long-running apps like navigation ​ Developers build apps using the or health trackers efficiently use application framework, with access memory without crashes to system resources managed through permissions. ​ Application Framework: Examples ○​ Acts as the intermediary layer ​ System Apps: Phone Dialer, between Android runtime and Contacts, Messaging, which are applications, providing essential preinstalled and critical for device APIs to developers for creating functionality. apps. ​ User-Installed Apps: Apps like ○​ It simplifies the development WhatsApp, Instagram, and Spotify, process by handling common tasks which use the framework APIs to such as managing UI components, access device capabilities like data sharing, and background messaging, media playback, and services. data storage Key Components Core Android Components ​ Activity Manager: Manages the activity lifecycle and navigation ​ Activities stack, ensuring seamless transitions ○​ building blocks of an Android between app screens. application, representing a single ​ Content Providers: Allows apps to screen with a user interface. access and share data with other ○​ handle user interactions and are apps securely. essential for navigating between ​ Resource Manager: Manages different parts of an app resources like strings, images, and layouts, enabling developers to Lifecycle States: create adaptable apps for different ​ Created, Started, Resumed: When devices. the activity is created and fully ​ Location Manager: Provides access visible to the user. to location services, such as GPS ​ Paused, Stopped: When the activity and network-based location. is partially or fully hidden but still ​ Notification Manager: Manages the running in the background. display of notifications, alerting ​ Destroyed: When the activity is users of important events. completely removed from memory Examples Examples ​ Activity Manager: Controls how an ​ Login Screen: An activity that app like Google Maps handles user manages user login credentials. inputs when navigating through ​ Dashboard: An activity displaying a multiple screens. summary of information, like in ​ Content Providers: Gmail can access fitness apps showing daily stats. contacts data provided by the phone ' s contacts app, allowing you ​ Services allowing apps to fetch and display ○​ run in the background to perform media content. long-running operations that do not need a user interface, such as UNIT 2: APPLICATIONS FUNDAMENTALS handling network transactions, playing music, or processing data. Android Studio Classic Workspace A.​ Menu Bar Types of Services ○​ Located at the very top the user can ​ Foreground Services: performs find the File Menu option that operations noticeable to the user contains various menus and and runs in the foreground of the settings related to file and project device. handlings. ​ Background Services: A service that B.​ Toolbar runs in the background without any ○​ Shows the tools and actions that user interface and without needing are frequently used by the user. user interaction. C.​ Navigation Bar ○​ Allows the user to easily navigate Examples and move around the files and ​ Music Player: A service running in folders of the project. the background to play audio, D.​ Editor Window allowing users to multitask. ○​ Shows the content of the file that ​ Data Sync: Used in apps like Google the user is currently working on. Drive to synchronize files between E.​ Status Bar the device and cloud storage ○​ Displays messages that give information such as code errors, ​ Broadcast Receivers: warnings, successful status. ○​ listen for system-wide broadcast F.​ Project Tool Window messages and react accordingly. ○​ Shows a hierarchical view of the files ○​ They enable apps to respond to and folders of the project. events even if they are not actively running. View and Viewgroup Types ​ System Broadcasts: Automatically ​ View sent by the system, like when the ○​ building block that represents the battery is low or the device is user interface of your application, charging and it occupies a rectangular area ​ Custom Broadcasts: Defined within in the application apps to communicate between ○​ created from the View class components or trigger specific ○​ occupies a rectangular area on the actions. screen Examples ○​ base class for widgets ​ Low Battery Warning: Triggers when ​ create interactive UI battery level drops, allowing apps to components like buttons, adjust behavior like reducing textviews background activity. ​ container of widgets or ​ Network Change: Notifies apps like other ViewGroups weather apps to update data when the network connection changes. Text: ​ Text View ○​ it is a user interface that is utilized ​ Content Providers to set and show the Text or content ○​ manage access to a structured set depending on the user’s needs. of data, facilitating data sharing ​ EditText between apps in a secure and ○​ A user interface element for consistent way. entering and modifying text. Usage ○​ Its default input type is plain text ​ Provides a standardized interface to query or modify data within an app. ❖​ Manipulate Edit Text types - password, ​ Content providers use URIs (Uniform e-mail, phone number, postal address, Resource Identifiers) to access data. multiline Text, time, date, number and etc Examples ​ Contacts App: Shares contact Buttons: information with apps like ​ Buttons WhatsApp or Messages. ○​ perform an action every time the ​ Media Provider: Manages access to user clicks it. images, audio, and video files, ​ Image Button ​ GridView ○​ button displays the image instead ○​ A view that shows items in a of Text, and it performs an action. two-dimensional scrolling grid. ​ Checkbox ​ Recycler view ○​ allows the user to select one or ○​ it is a flexible and combination of more options. ListView and GridView. ○​ usually used in some type of form ​ Scroll view such as registration form, login ○​ this allows the view place within it to form, exam, and quizzes be scrolled. You can place only one ​ Radio button direct child inside this view ○​ allows the user to select one option ○​ used to determine a single answer Google from the list of choices ​ Ad view ​ Toggle button ○​ view that you can set and display a ○​ simply called a switch banner and ads in your application ○​ button that allows you to control ​ Map view and change settings between two ○​ view that you can set and display a different states map in your application, and it obtains data from google maps Widgets ​ Image view Project Tool Window ○​ displays an image/pictures; this is ​ AndroidManifest.xml to add a user interface more ○​ important part of our app exciting ○​ defines the structure and metadata ​ Web view of our application, its components, ○​ allows you to display the content of and its requirements. a website inside your application. ​ Java: ​ Video view ○​ contains the Java source code files ○​ allows you to display a video file ○​ used as a controller for controlled from your application. UI ​ Calendar view ​ drawable ○​ this widget allows you to display and ○​ contains resource type file select a date from the calendar view. (something that can be drawn). ○​ take a variety of file like Bitmap Layouts (PNG, JPEG), Nine Patch, Vector ​ Constraint layout (XML), Shape, Layers, States, Levels, ○​ this is a layout that allows the and Scale. programmer to size and position ​ layout widgets in a flexible user interface. ○​ defines the visual structure for a ​ Linear layout user interface, such as the UI for an ○​ this layout arranges views into a Android application. single row vertically and single ○​ Layout files that are written in XML columns in a horizontal way language ​ Frame layout ​ mipmap ○​ allows you to block a single area ○​ Image Asset file that can be used in and display an item in the front of Android Studio application. the screen ○​ generate the following icon types ​ Table layout like Launcher icons, Action bar and ○​ a layout that you can arrange into tab icons, and Notification icons rows and columns, and it consists of ​ colors.xml a number of table rows and column ○​ contains color resources of the objects. Android application. ​ strings.xml Container ○​ contains string resources of the ​ Spinner Android application. ○​ is a view that let the user pick ○​ identified by a unique name that among the listed item inside this can be used in the Android child. In other programs, they call application program this a drop-down box ​ styles.xml ​ List View ○​ contains resources of the theme ○​ Displays a vertically-scrollable style in the Android application. collection of views, where each view ​ build.gradle(Module:app) is positioned immediately below the ○​ module-specific build previous view in the list. configurations. ○​ add dependencies what you need in your Android application. Spinner UNIT 3: ANDROID USER INTERFACE ​ Allow a user to select one value from the list of values. Introduction to View and ViewGroup 1.​ View a.​ basic building block for user interface b.​ created from the View class c.​ occupies a rectangular area on the screen d.​ base class for widgets i.​ create interactive UI components like buttons, textviews ii.​ container of widgets or other ViewGroups. Layouts ViewGroup Common Views and Layouts ​ subclass of View TextView ​ provides invisible container that HOLD ​ Displays text to the user. other Views or other ViewGroups and define their layout properties ​ talking generally about Layout. Layout ​ defines the visual structure for an Android user interface. ​ has its own purpose, pros, and cons. EditText ​ Also known as text fields, allows the user to enter a text on it. Button ​ Represents a push-button widget. ❖​ You can declare a layout (widgets also) in 2 ways: ​ Declare UI elements in XML ​ provides a straightforward XML vocabulary ImageView ​ corresponds to the View ​ Allows you to add an image. classes and subclasses, such as those for widgets and layouts. ​ Instantiate layout elements at runtime ​ Your app can create View and ViewGroup objects (and manipulate their properties) programmatically. Common Layouts 3.​ mm (Millimeters) Linear Layout a.​ based on the physical size of the ​ view group that aligns all screen. children in a single 4.​ pt (Points) direction. a.​ 1/72 of an inch based on the ​ either vertical or horizontal physical size of the screen. 5. ​ specify the layout direction 5.​ dp or dip (Density-independent Pixels) with the android:orientation a.​ an abstract unit that is based on attribute. the physical density of the screen. 6.​ sp (Scalable Pixels OR scale-independent Relative Layout pixels) ​ displays child views in a.​ this is like the dp unit relative positions. b.​ also scaled by the user's font size ​ each view can be specified preference. as relative to sibling c.​ recommended this unit when elements specifying font sizes i.​ adjusted for both the screen Frame Layout density and user's preference. ​ a placeholder on screen that you can use to display a ❖​ Constants to set the width or height single view ​ allows placing views on the (Syntax): top of other views. android:layout_width=wrap_content ​ tells your view to size itself to the dimensions required by its content. ListView ​ view group that displays a android:layout_width=match_parent list of scrollable items. ​ tells your view to become as big as its parent view. GridView ​ ViewGroup that displays android:layout_marginTop items in a two-dimensional, ​ extra space on the top side of the layout. scrollable grid. android:layout_marginBottom ConstraintLayout ​ extra space on the bottom side of the ​ allows you to create large and complex layout. layouts with a flat view hierarchy android:layout_marginLeft ​ extra space on the left side of the layout. android:layout_marginRight ​ extra space on the right side of the layout. android:layout_gravity ​ specifies how child Views are positioned. android:layout_weight ​ specifies how much of the extra space in the layout should be allocated to the View. Layouts Attributes android:id ​ ID which uniquely identifies the view. android:layout_width ​ width of the layout. android:layout_height ​ height of the layout. 1.​ px (Pixels) a.​ corresponds to actual pixels on the screen. 2.​ in (Inches) Gravity Attributes a.​ based on the physical size of the ​ important role in positioning the view objec screen. ​ it can take one or more (separated by '|') of b.​ 1 Inch = 2.54 centimeters the following constant values ​ Place the object in the “position” of its container, not changing its size. ○​ Top ○​ bottom ○​ left ○​ right ○​ center_vertical ○​ center_horizontal ○​ center ○​ clip_vertical ○​ clip_horizontal ○​ start ○​ end ​ Grow the “direction” size of the object if needed so it completely fills its container ○​ Fill ○​ fill_horizontal ○​ fill_vertical android:paddingLeft,Right,Top,Bottom ​ This is the left or right or top or bottom padding filled for the layout.

Use Quizgecko on...
Browser
Browser