SlideShare a Scribd company logo
https://tech.showmax.com
@ShowmaxDevs
Android crash course
From zero to hero
michal.ursiny@showmax.com
Sample project:
https://github.com/Showmax/GithubUsersSearch
https://tech.showmax.com
@ShowmaxDevs
Why develop for Android
● Because android rules! At least for Showmax users #1
platform
● Development easily available on any platform, be it
Windows, Linux, MacOS, ChromeOS
● Vast target audience with variety of devices and form
factors, phones, tablets, wear os (watches), android TVs,
android auto, IOT
https://tech.showmax.com
@ShowmaxDevs
How to start - Android Studio
● Just download Android Studio - official IDE based on IntelliJ
IDEA
● Configure your emulator or enable developer mode on your
device
● Get acquainted with Android Studio
https://tech.showmax.com
@ShowmaxDevs
Kotlin vs Java
● Code compiled to JAVA bytecode whatever you write your
app with
● Kotlin resolves nullability issue - forces you to avoid dreaded
NullPointerException in compile time and has number of
features that helps you write more concise code (data classes)
● However, Java is still fully supported and some newer Java
APIs are available
https://tech.showmax.com
@ShowmaxDevs
You know why and how
Let’s look deeper into features and specifics of Android
development
https://tech.showmax.com
@ShowmaxDevs
Start new project from template
Good as a starting point
Definitely not a complete solution,
often a bit outdated.
https://tech.showmax.com
@ShowmaxDevs
Task #1
● Create a new project from template
● Run on emulator / device
● Try to modify some title/string
https://tech.showmax.com
@ShowmaxDevs
What version ?
● Basically you don’t want to support
anything older than 5.0 from technical
point of view, business-wise at Showmax
we do support from 4.4 and it’s pain
● Starting 5.0 Android has new runtime
called ART with much better memory
handling / garbage collection + a lot of
improvements in UI, support for
VectorDrawables
https://tech.showmax.com
@ShowmaxDevs
New APIs - not available on older versions ?
● Often you will notice that used classes are not from platform
API, but rather from compatibility libraries (AppCompat,
AndroidX), which provides compatible back-ported
versions/layers, which enables you to write code knowing it
will run on older versions as well, maybe sometimes with
some degradation; some components exists only in these
libraries and aren’t actually part of platform (eg.:
ConstraintLayout), but de-facto considered as such)
https://tech.showmax.com
@ShowmaxDevs
Project structure overview
● Different views on project - android view vs. project view
● app module
● src - your kotlin/java source code
● res - your resources, images, strings, values
● AndroidManifest.xml - defines entry point to your app
● build.gradle under your app module - build & dependencies
configurations
https://tech.showmax.com
@ShowmaxDevs
Basic building blocks of Android app
Application
Activity
Fragment
View
View
Activity
Fragment
Fragment
View
View
Others: Services, Broadcast receivers, Content Providers,... we ignore here
You may think of Activity
like screen; Activity can
contain one or multiple
Fragments for better re-
usability
View is like Button,
TextView, etc.
https://tech.showmax.com
@ShowmaxDevs
Fragments reusability
https://tech.showmax.com
@ShowmaxDevs
Build UI
● Layouts are written in XML using build in Android Studio
Editor
● Nowadays your root element is often ConstraintLayout and all
its children are laid out by setting up constraints
● ViewGroup(s): ConstraintLayout, LinearLayout,
FrameLayout,... - may contain multiple other View(s)
https://tech.showmax.com
@ShowmaxDevs
Task #2 - build simple UI
1. Edit layout file from newly created project, make sure your
root element is ConstraintLayout
2. Add EditText and Button constrained horizontally and
vertically
3. Attach OnClickListener to Button and display Toast
https://tech.showmax.com
@ShowmaxDevs
Binding views
● Every view has to have an id to be viewable
● Oldschool findViewById - always an option
● ViewBinding - sweet spot
● DataBinding
● 3rd party tools like Butterknife
● Jetpack Compose
https://tech.showmax.com
@ShowmaxDevs
Themes & Styles
Application has a root theme, which defines basic look & feel
Material Components library recommended, provides latest
updated components
https://github.com/material-components/material-components-
android/blob/master/docs/getting-started.md
https://tech.showmax.com
@ShowmaxDevs
Task #3: change to Material theme
1. Add material components library
2. Change application theme
3. Update layout to use TextInputLayout / TextInputEditText
instead of plain EditText
https://tech.showmax.com
@ShowmaxDevs
Take advantage of Resource system
● drawables - your images/vector drawables
● layouts
● values - strings, dimens, integers, bools
Use qualifiers to your advantage:
● Locales - values-cs-rCZ
● Orientation - layout-land / layout-port
● Display size - layout-sw600 (smallest-width)
https://tech.showmax.com
@ShowmaxDevs
Device independent pixels
As different devices have different screen sizes and density of
pixels, we are avoiding pixels, but rather using dp - device
independent pixels, so that the sizes are relatively same on
different devices.
For fonts there are sp - which are scaled by user preference
All dimens should be references from resources.
https://tech.showmax.com
@ShowmaxDevs
Lifecycles - here comes the pain
● Activities and Fragments are subject to lifecycles
● You are not creating them, they are created by system (you
are just creating Intent and asking system to create it or
submit Fragment transaction to FragmentManager) and you
are just being given callbacks
https://tech.showmax.com
@ShowmaxDevs
Lifecycles activity / fragment
Hint: print these out if you are going
for Android developer interview ;-)
https://tech.showmax.com
@ShowmaxDevs
Lifecycles - take away
● Activities and Fragments may disappear as system see fit
● When they are in background, system may kill them
● During configuration changes like orientation change/rotation they are
recreated
● You really cannot depend they live
● They give you chance to save your state and restore it, but
that’s pretty much boiler plate and you don’t want to do it
https://tech.showmax.com
@ShowmaxDevs
ViewModels to the rescue
Activity
Fragment
View
ViewModel
state: LiveData
survives configuration changes
Your business
logic updates
state
click!
UI logic
Fragment observes
LiveData state from
viewModel
DUMB!
https://tech.showmax.com
@ShowmaxDevs
ViewModels - more info
● https://developer.android.com/topic/libraries/architecture/
viewmodel
● Avoid putting business logic to Activities/Fragments (it’s
BAD, BAD, BAD!)- treat them as dumb view layer only
responsible to update its views and send events to ViewModel
https://tech.showmax.com
@ShowmaxDevs
Permissions
To be able to gain access to certain system features app needs to
declare permissions in AndroidManifest.xml
● like android.permission.INTERNET
● dangerous permissions you need to ask user to give you that
permission like LOCATION, RECORD_AUDIO,
READ_CONTACTS,...
https://tech.showmax.com
@ShowmaxDevs
REST API - Retrofit
● Library for REST API communication
● Industry standard, otherwise a lot of boilerplate code and
manual parsing (no fun)
● 1. Create data objects
● 2. Define interface
● 3. Create Retrofit client with configured converter using
selected deserializer (preferably JSON, possibly XML and
more)
https://square.github.io/retrofit/
interface ShowmaxApi {
@GET("catalogue/search")
suspend fun search(@Query("q") query: String): SearchResponse
}
https://tech.showmax.com
@ShowmaxDevs
Retrofit - usage
● Network calls (and possibly other long running tasks) needs
to happen on background thread
● Retrofit can generate suspend functions, which you can
launch in coroutine scope with viewModel support
https://tech.showmax.com
@ShowmaxDevs
Displaying results - RecyclerView
● Used to display lists & grids
● You need to create Adapter
https://tech.showmax.com
@ShowmaxDevs
Image loading
● ImageView is your go to View for displaying images
● No native remote URL displaying capability
● Image Loading libraries:
● Glide (that’s what we use)
● Picasso
● Fresco (from Facebook)
● Coil (Kotlin first library)
● ...
https://tech.showmax.com
@ShowmaxDevs
Further improvements
● Introduce Dependency Injection
● Apply obfuscation to your release builds
● buildTypes (debug/release) /productFlavors
(staging/production) if needed
● Publish on Google Play store
PROFIT!
https://tech.showmax.com
@ShowmaxDevs
Thank you - Q&A
Contact me:
michal.ursiny@showmax.com
Twitter: @ursimon

More Related Content

What's hot (20)

PPTX
What’s new in aNdroid [Google I/O Extended Bangkok 2016]
Sittiphol Phanvilai
 
PDF
Cordova + Ionic + MobileFirst
Raymond Camden
 
PPTX
Realtime applications for SharePoint with SignalR and knockout.js
Christian Heindel
 
PDF
Why does .net maui deserve your attention if you’re planning to use xamarin
Moon Technolabs Pvt. Ltd.
 
PDF
Modern JavaScript Frameworks: Angular, React & Vue.js
Jonas Bandi
 
PPTX
Cross-Platform Development using Angulr JS in Visual Studio
Mizanur Sarker
 
PPTX
Mobile Apps Develpment - A Comparison
Lataant Software Technologies
 
PPTX
Apps für SharePoint 2013 (Office Store, Windows 8, Windows Phone 8)
Christian Heindel
 
DOC
Saloni_Tyagi
Saloni Tyagi
 
PPTX
12 Frameworks for Mobile Hybrid Apps
Filipe Lima
 
PPT
Android - Anroid Pproject
Vibrant Technologies & Computers
 
PDF
React js vs angularjs which framework to choose in 2022_
Moon Technolabs Pvt. Ltd.
 
PDF
Cordova 3, apps para android
Droidcon Spain
 
PPTX
Introduction to Apache Cordova (Phonegap)
ejlp12
 
PPTX
Web application framework
Pankaj Chand
 
DOCX
Basic Java script handouts for students
shafiq sangi
 
DOCX
Mahesh_Dimble
Mahesh Dimble
 
PPTX
Convert your Full Trust Solutions to the SharePoint Framework (SPFx) in 1 hour
Brian Culver
 
PPT
SD Forum Java SIG - Service Oriented UI Architecture
Jeff Haynie
 
PDF
Frontend Monoliths: Run if you can!
Jonas Bandi
 
What’s new in aNdroid [Google I/O Extended Bangkok 2016]
Sittiphol Phanvilai
 
Cordova + Ionic + MobileFirst
Raymond Camden
 
Realtime applications for SharePoint with SignalR and knockout.js
Christian Heindel
 
Why does .net maui deserve your attention if you’re planning to use xamarin
Moon Technolabs Pvt. Ltd.
 
Modern JavaScript Frameworks: Angular, React & Vue.js
Jonas Bandi
 
Cross-Platform Development using Angulr JS in Visual Studio
Mizanur Sarker
 
Mobile Apps Develpment - A Comparison
Lataant Software Technologies
 
Apps für SharePoint 2013 (Office Store, Windows 8, Windows Phone 8)
Christian Heindel
 
Saloni_Tyagi
Saloni Tyagi
 
12 Frameworks for Mobile Hybrid Apps
Filipe Lima
 
Android - Anroid Pproject
Vibrant Technologies & Computers
 
React js vs angularjs which framework to choose in 2022_
Moon Technolabs Pvt. Ltd.
 
Cordova 3, apps para android
Droidcon Spain
 
Introduction to Apache Cordova (Phonegap)
ejlp12
 
Web application framework
Pankaj Chand
 
Basic Java script handouts for students
shafiq sangi
 
Mahesh_Dimble
Mahesh Dimble
 
Convert your Full Trust Solutions to the SharePoint Framework (SPFx) in 1 hour
Brian Culver
 
SD Forum Java SIG - Service Oriented UI Architecture
Jeff Haynie
 
Frontend Monoliths: Run if you can!
Jonas Bandi
 

Similar to Android crash course (20)

PDF
Android development first steps
christoforosnalmpantis
 
PDF
Effective Android UI - English
Pedro Vicente Gómez Sánchez
 
PPTX
Introduction to Android Development.pptx
asmeerana605
 
PPTX
Introduction to Android- A session by Sagar Das
dscfetju
 
PPTX
Android app fundamentals
Amr Salman
 
PDF
Create first android app with MVVM Architecture
khushbu thakker
 
PPT
Android class provider in mumbai
Vibrant Technologies & Computers
 
PPTX
Android app development
PiyushBhambhani1
 
PPTX
Android Applications Development: A Quick Start Guide
Sergii Zhuk
 
PDF
Android Application Development - Level 1
Isham Rashik
 
PDF
Android Introduction Talk
Stefan Blos
 
PPTX
GDG School Android Workshop
Abderraouf GATTAL
 
PPTX
Android beginners David
Arun David Johnson R
 
PDF
Mobile Application Development Lecture 05 & 06.pdf
AbdullahMunir32
 
PPTX
Android apps development
Raman Pandey
 
PPTX
Google Associate Android Developer Certification
Monir Zzaman
 
PDF
The Good, the Bad and the Ugly things to do with android
Stanojko Markovik
 
PPTX
Intro to android (gdays)
Omolara Adejuwon
 
PDF
Android Programming - The Big Nerd Ranch Guide
Karen Gomez
 
PDF
Milos Marinkovic "Modular Android UI"
IT Event
 
Android development first steps
christoforosnalmpantis
 
Effective Android UI - English
Pedro Vicente Gómez Sánchez
 
Introduction to Android Development.pptx
asmeerana605
 
Introduction to Android- A session by Sagar Das
dscfetju
 
Android app fundamentals
Amr Salman
 
Create first android app with MVVM Architecture
khushbu thakker
 
Android class provider in mumbai
Vibrant Technologies & Computers
 
Android app development
PiyushBhambhani1
 
Android Applications Development: A Quick Start Guide
Sergii Zhuk
 
Android Application Development - Level 1
Isham Rashik
 
Android Introduction Talk
Stefan Blos
 
GDG School Android Workshop
Abderraouf GATTAL
 
Android beginners David
Arun David Johnson R
 
Mobile Application Development Lecture 05 & 06.pdf
AbdullahMunir32
 
Android apps development
Raman Pandey
 
Google Associate Android Developer Certification
Monir Zzaman
 
The Good, the Bad and the Ugly things to do with android
Stanojko Markovik
 
Intro to android (gdays)
Omolara Adejuwon
 
Android Programming - The Big Nerd Ranch Guide
Karen Gomez
 
Milos Marinkovic "Modular Android UI"
IT Event
 
Ad

More from Showmax Engineering (6)

PPTX
PostgreSQL Terminology
Showmax Engineering
 
PDF
Networking fundamentals
Showmax Engineering
 
PDF
PostgreSQL Monitoring using modern software stacks
Showmax Engineering
 
PDF
Implementing GraphQL - Without a Backend
Showmax Engineering
 
PDF
Deep learning features and similarity of movies based on their video content
Showmax Engineering
 
PDF
2015 11-12 GoLang Meetup Praha
Showmax Engineering
 
PostgreSQL Terminology
Showmax Engineering
 
Networking fundamentals
Showmax Engineering
 
PostgreSQL Monitoring using modern software stacks
Showmax Engineering
 
Implementing GraphQL - Without a Backend
Showmax Engineering
 
Deep learning features and similarity of movies based on their video content
Showmax Engineering
 
2015 11-12 GoLang Meetup Praha
Showmax Engineering
 
Ad

Recently uploaded (6)

PPTX
Mobile Apps Helping Business Grow in 2025
Infylo Techsolutions
 
PDF
💡 Digital Marketing Decoded: Mastering Online Growth Strategies for 2025 🚀
marketingaura24
 
PDF
INTERLINGUAL SYNTACTIC PARSING: AN OPTIMIZED HEAD-DRIVEN PARSING FOR ENGLISH ...
kevig
 
PPTX
The Intersection of Emoji and NFT. What can be the Consequences?
Refit Global
 
PDF
Call For Papers - International Journal on Natural Language Computing (IJNLC)
kevig
 
PDF
Building Smart, Scalable Solutions with Android App Development
Brancosoft Private Limited
 
Mobile Apps Helping Business Grow in 2025
Infylo Techsolutions
 
💡 Digital Marketing Decoded: Mastering Online Growth Strategies for 2025 🚀
marketingaura24
 
INTERLINGUAL SYNTACTIC PARSING: AN OPTIMIZED HEAD-DRIVEN PARSING FOR ENGLISH ...
kevig
 
The Intersection of Emoji and NFT. What can be the Consequences?
Refit Global
 
Call For Papers - International Journal on Natural Language Computing (IJNLC)
kevig
 
Building Smart, Scalable Solutions with Android App Development
Brancosoft Private Limited
 

Android crash course

Editor's Notes

  • #3: Online Video Streaming Service Built upon microservice architecture (we love containers) We are distributed (EU + Africa) We log everything! Engineering in Prague and Beroun Showmax is a distributed company We server content for africa and eu To be able to control and monitor such a large platform, everything must be logged Jak to udelat po celym svete Servirujeme content po a+eu Logujeme takze vime o vsem Za chvili uvidite, proc je logovani dulezite