SlideShare a Scribd company logo
Android Architecture
Components
Muhammad Ali
Software Architect
VentureDive
Architecture
• What is architecture
• Why is architecture required?
• How architecture is different from design?
• Popular architectural patterns
• MVC
• MVP
• MVVM
• VIPER
Android Architecture Components
• Google’s official guidelines to architect your Android applications
• Reduce boilerplate
• Separation of concerns
• Testability
• Maintainability
• Ease of Implementation
Android Architecture
Components
• Activities/Fragments
• Represents View Layer
• Handle UI events
• ViewModel
• Observes View lifecycle events
• Bring data from Repository and update
Views
• Uses LiveData to observe changes to
the data in repository
• Repository
• Brings data from sqlite using Room
• Brings data from services
Lifecycle
• Problems without lifecycle
• Sometimes services starts after activity stops, for example a long running
code is being executed in onStart and after that a particular
component/service is started
• In that case component/service is alive when it shouldn’t be
• Lifecycle solves this problem with events and states
• Component can be made lifecycle aware with the help of following
• LifeCycleObserver
• LifeCycleOwner
ViewModel
• View Model is designed to store and manage UI related data in
lifecycle conscious way
• Idea is same, keep Views free from fetching and managing any data
• ViewModel survives configuration changes such as screen resolutions
• ViewModel must not reference a view
• If you need context in a ViewModel, use AndroidViewModel class
ViewModel
LiveData
• LiveData is an observable data holder class
• LiveData is lifecycle aware
• Lifecycle awareness ensures LiveData only update app components
observers that are in active lifecycle state
• Ensure UI is consistent with data
• Sharing resources
• Enduring configuration changes
Room
• Room persistence library provides an abstraction layer over sqlite
• It helps you create a cache of your app’s data on a device running
your app
• This cache acts as a system of record or single source of truth
• Provides an ORM capability with annotations and compile time code
generation
• Remove boilerplate code for creating DAO
Questions?
Thank you

More Related Content

PDF
iOS Project modularisation
PDF
BEA's microService Architecture and OSGi- How Customers Benefit - Craig Blitz...
PDF
WaveMaker Next: Webinar - Presentation
PPTX
Wavemaker RAD for the Cloud with CloudJee - Future Direction 2014
PDF
Application Development with Microservices and Widgets
PPTX
Mobile application development
PPTX
Genexus - part 3 - process management
PDF
MVP Clean Architecture
iOS Project modularisation
BEA's microService Architecture and OSGi- How Customers Benefit - Craig Blitz...
WaveMaker Next: Webinar - Presentation
Wavemaker RAD for the Cloud with CloudJee - Future Direction 2014
Application Development with Microservices and Widgets
Mobile application development
Genexus - part 3 - process management
MVP Clean Architecture

Similar to Android architectural components (20)

PPTX
iOS Coding Best Practices
PDF
PPTX
Architectural Design & Patterns
PDF
MVC Seminar Presantation
PPTX
Getting started with MVC 5 and Visual Studio 2013
PPTX
Mobile App Architectures & Coding guidelines
PPTX
MVVM and Prism
PPTX
Knockout implementing mvvm in java script with knockout
PPTX
MVC + ORM (with project implementation)
PPTX
Spring Web Presentation 123143242341234234
PDF
How to grow your own Microservice?
PPTX
Manage your devices with Azure IoT...and more
PPTX
Mvc pattern and implementation in java fair
PPTX
Introduction to j2 ee frameworks
PDF
Tech Talk on Cloud Computing
PDF
Mastering angular - Dot Net Tricks
PPTX
Spring
PDF
Integrating SharePoint 2010, 2013 and Visual Studio Lightswitch by Rob Windso...
PDF
software architecture
PPT
Developing modular Java applications
iOS Coding Best Practices
Architectural Design & Patterns
MVC Seminar Presantation
Getting started with MVC 5 and Visual Studio 2013
Mobile App Architectures & Coding guidelines
MVVM and Prism
Knockout implementing mvvm in java script with knockout
MVC + ORM (with project implementation)
Spring Web Presentation 123143242341234234
How to grow your own Microservice?
Manage your devices with Azure IoT...and more
Mvc pattern and implementation in java fair
Introduction to j2 ee frameworks
Tech Talk on Cloud Computing
Mastering angular - Dot Net Tricks
Spring
Integrating SharePoint 2010, 2013 and Visual Studio Lightswitch by Rob Windso...
software architecture
Developing modular Java applications
Ad

More from Muhammad Ali (9)

PPTX
Communication Mechanisms, Past, Present & Future
PPTX
WebRTC Introduction & Basics
PPTX
Introduction to Architectural Katas
PPTX
Domain Driven Design
PPTX
DBMS Modeling & Optimization
PDF
Architectural katas
PDF
Software Architecture Meetup introduction
PDF
Practicing DDD & CQRS
PDF
Introduction to Domain driven design
Communication Mechanisms, Past, Present & Future
WebRTC Introduction & Basics
Introduction to Architectural Katas
Domain Driven Design
DBMS Modeling & Optimization
Architectural katas
Software Architecture Meetup introduction
Practicing DDD & CQRS
Introduction to Domain driven design
Ad

Recently uploaded (20)

PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PPTX
Online Work Permit System for Fast Permit Processing
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPTX
Introduction to Artificial Intelligence
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Digital Strategies for Manufacturing Companies
PDF
System and Network Administration Chapter 2
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
AI in Product Development-omnex systems
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Nekopoi APK 2025 free lastest update
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
ManageIQ - Sprint 268 Review - Slide Deck
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Online Work Permit System for Fast Permit Processing
VVF-Customer-Presentation2025-Ver1.9.pptx
Introduction to Artificial Intelligence
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Digital Strategies for Manufacturing Companies
System and Network Administration Chapter 2
Softaken Excel to vCard Converter Software.pdf
AI in Product Development-omnex systems
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Nekopoi APK 2025 free lastest update
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
ISO 45001 Occupational Health and Safety Management System
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Understanding Forklifts - TECH EHS Solution
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx

Android architectural components

  • 2. Architecture • What is architecture • Why is architecture required? • How architecture is different from design? • Popular architectural patterns • MVC • MVP • MVVM • VIPER
  • 3. Android Architecture Components • Google’s official guidelines to architect your Android applications • Reduce boilerplate • Separation of concerns • Testability • Maintainability • Ease of Implementation
  • 4. Android Architecture Components • Activities/Fragments • Represents View Layer • Handle UI events • ViewModel • Observes View lifecycle events • Bring data from Repository and update Views • Uses LiveData to observe changes to the data in repository • Repository • Brings data from sqlite using Room • Brings data from services
  • 5. Lifecycle • Problems without lifecycle • Sometimes services starts after activity stops, for example a long running code is being executed in onStart and after that a particular component/service is started • In that case component/service is alive when it shouldn’t be • Lifecycle solves this problem with events and states • Component can be made lifecycle aware with the help of following • LifeCycleObserver • LifeCycleOwner
  • 6. ViewModel • View Model is designed to store and manage UI related data in lifecycle conscious way • Idea is same, keep Views free from fetching and managing any data • ViewModel survives configuration changes such as screen resolutions • ViewModel must not reference a view • If you need context in a ViewModel, use AndroidViewModel class
  • 8. LiveData • LiveData is an observable data holder class • LiveData is lifecycle aware • Lifecycle awareness ensures LiveData only update app components observers that are in active lifecycle state • Ensure UI is consistent with data • Sharing resources • Enduring configuration changes
  • 9. Room • Room persistence library provides an abstraction layer over sqlite • It helps you create a cache of your app’s data on a device running your app • This cache acts as a system of record or single source of truth • Provides an ORM capability with annotations and compile time code generation • Remove boilerplate code for creating DAO