SlideShare a Scribd company logo
Lecture #3
Activities && Intents
General Stuff
- Facebook Group
- Udacity Lesson #3
- Study Jam Group Signup
- My ActionBar looks different
- 23/2 No lesson
Udacity Lesson Overview
- Listeners
- Toast
- UP Navigation vs Back Navigation(TASK)
- StartActivity
- Intent (bundle) Implicitly & Explicitly
- Fragment
- Settings
- SharedPreferences
- BroadCast Receivers
Toast
Context
- Global information about an application
environment
- Loading resources, launching a new
Activity, obtaining a system service,
getting internal file paths, and creating
views
- Biggest memory leak potential (latter in
our sessions)
Listeners
Interface related to view with
single callback.
Will be called when event is
occur
Event Listeners
onClick() - View.OnClickListener
onLongClick() - View.OnLongClickListener
onFocusChange() -
View.OnFocusChangeListener
onKey() - View.OnKeyListener
onTouch() - View.OnTouchListener
onCreateContextMenu() - View guess what :)
Lecture #3: Android Academy Study Jam
But?
- Hard to maintain
- Hard to find which button do what
- Every class in Java, including anonymous
inner classes which create an object and
writes accessor methods internally, uses
about 500 bytes of code.
Lecture #3: Android Academy Study Jam
Navigation UP and Back
- Task and Backstack
- Back navigation is within Task
- UP is hierarchical navigation
Intent
- Has address
- Has data map: key = value
- Has schema
You can pass any primitive types and also
serializable/Parcelable objects
Used to send data/action across the system
StartActivity
Explicitly:
Implicitly:
But what if?
But what if?
But what if?
- Non readable
- Mix of static variables
- Other activities should know what target
expect
Solution
Solution
Fragment
The biggest advantage
and pain
- .commit() asynchronous
- any operation after state of Activity was
saved
- Getting “Context” within Fragment
Solution
- Use callbacks when possible.
- Manage internal state of activity and
fragment
- DialogFragment special treatment
SharedPreferences
- Great thing to store persistent various.
- Not accessible by other apps
- Used to save things between session
and session
- Sometimes could be great
communication tool (like intent) using
“onSharedPreferenceChangeListener”
Lecture #3: Android Academy Study Jam
But...
- Don’t forget that each commit() is IO
operation.
- use Apply() instead
Broadcast Receivers
Great guy :)
- Loose Coupling
- 1-to-n relationship
- The onReceive() method is always executed on the
main thread
- You can notify components in your entire application, so
the communicating components do not have to "see"
each other.
But...
- Marshaling data via intent really hard
- Register/Unregister it when you do not needed him
(BaseActivity)
- Not impossible to transfer large objects
Lecture #3: Android Academy Study Jam
Lecture #3: Android Academy Study Jam
Lecture #3: Android Academy Study Jam

More Related Content

PPT
DOC
Elementos del lenguaje
PDF
Class 01 - Android Study Jams: Android Development for Beginners
PDF
Lecture 2(b) Android Internals A Quick Overview
PPT
Mobile Application Development With Android
PPT
Mobile Application Development
PDF
Android Jumpstart Jfokus
PDF
Android development - Activities, Views & Intents
Elementos del lenguaje
Class 01 - Android Study Jams: Android Development for Beginners
Lecture 2(b) Android Internals A Quick Overview
Mobile Application Development With Android
Mobile Application Development
Android Jumpstart Jfokus
Android development - Activities, Views & Intents

Similar to Lecture #3: Android Academy Study Jam (20)

PPT
"Android" mobilių programėlių kūrimo įvadas #2
ODP
Nativa Android Applications development
PPTX
Unit-1.2 Android-Activities, Fragments, and Intents (1).pptx
PPTX
Lecture #3 activities and intents
PDF
Android development first steps
PDF
Mobile Application Development -Lecture 09 & 10.pdf
PPT
Android app development
PDF
Android activities & views
PPTX
Introduction to Android Development
PDF
Android Bootcamp
ODP
Ppt 2 android_basics
PDF
Android Jump Start
PDF
Android Basic Components
PPT
Lecture-3.ppt
PPT
android.ppt
PDF
Android development - the basics, MFF UK, 2012
PPTX
11.11.2020 - Unit 5-3 ACTIVITY, MENU AND SQLITE DATABASE.pptx
PPT
Android training in mumbai
PPTX
Android app fundamentals
PPTX
Android beginners David
"Android" mobilių programėlių kūrimo įvadas #2
Nativa Android Applications development
Unit-1.2 Android-Activities, Fragments, and Intents (1).pptx
Lecture #3 activities and intents
Android development first steps
Mobile Application Development -Lecture 09 & 10.pdf
Android app development
Android activities & views
Introduction to Android Development
Android Bootcamp
Ppt 2 android_basics
Android Jump Start
Android Basic Components
Lecture-3.ppt
android.ppt
Android development - the basics, MFF UK, 2012
11.11.2020 - Unit 5-3 ACTIVITY, MENU AND SQLITE DATABASE.pptx
Android training in mumbai
Android app fundamentals
Android beginners David
Ad

More from Yonatan Levin (15)

PDF
Knock, knock, who is there? Doze.
PDF
Android Performance #4: Network
PDF
Performance #1: Memory
PDF
A friend in need - A JS indeed
PDF
Mobile UI: Fruit or Delicious sweets
PPTX
Ipc: aidl sexy, not a curse
PPTX
IPC: AIDL is sexy, not a curse
PPTX
How to create Great App
PPTX
Mobile world
PPTX
Data binding
PPTX
What's new in android M(6.0)
PPTX
Performance
PPTX
IPC: AIDL is not a curse
PDF
Fragments, the love story
PDF
Lecture #1 intro,setup, new project, sunshine
Knock, knock, who is there? Doze.
Android Performance #4: Network
Performance #1: Memory
A friend in need - A JS indeed
Mobile UI: Fruit or Delicious sweets
Ipc: aidl sexy, not a curse
IPC: AIDL is sexy, not a curse
How to create Great App
Mobile world
Data binding
What's new in android M(6.0)
Performance
IPC: AIDL is not a curse
Fragments, the love story
Lecture #1 intro,setup, new project, sunshine
Ad

Recently uploaded (20)

PPTX
Transform Your Business with a Software ERP System
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
Introduction to Artificial Intelligence
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Nekopoi APK 2025 free lastest update
PPTX
history of c programming in notes for students .pptx
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
Essential Infomation Tech presentation.pptx
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
medical staffing services at VALiNTRY
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
Transform Your Business with a Software ERP System
Operating system designcfffgfgggggggvggggggggg
Introduction to Artificial Intelligence
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Understanding Forklifts - TECH EHS Solution
Nekopoi APK 2025 free lastest update
history of c programming in notes for students .pptx
Reimagine Home Health with the Power of Agentic AI​
wealthsignaloriginal-com-DS-text-... (1).pdf
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Which alternative to Crystal Reports is best for small or large businesses.pdf
Navsoft: AI-Powered Business Solutions & Custom Software Development
Essential Infomation Tech presentation.pptx
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
medical staffing services at VALiNTRY
Wondershare Filmora 15 Crack With Activation Key [2025
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
VVF-Customer-Presentation2025-Ver1.9.pptx
Upgrade and Innovation Strategies for SAP ERP Customers

Lecture #3: Android Academy Study Jam

  • 2. General Stuff - Facebook Group - Udacity Lesson #3 - Study Jam Group Signup - My ActionBar looks different - 23/2 No lesson
  • 3. Udacity Lesson Overview - Listeners - Toast - UP Navigation vs Back Navigation(TASK) - StartActivity - Intent (bundle) Implicitly & Explicitly - Fragment - Settings - SharedPreferences - BroadCast Receivers
  • 5. Context - Global information about an application environment - Loading resources, launching a new Activity, obtaining a system service, getting internal file paths, and creating views - Biggest memory leak potential (latter in our sessions)
  • 6. Listeners Interface related to view with single callback. Will be called when event is occur
  • 7. Event Listeners onClick() - View.OnClickListener onLongClick() - View.OnLongClickListener onFocusChange() - View.OnFocusChangeListener onKey() - View.OnKeyListener onTouch() - View.OnTouchListener onCreateContextMenu() - View guess what :)
  • 9. But? - Hard to maintain - Hard to find which button do what - Every class in Java, including anonymous inner classes which create an object and writes accessor methods internally, uses about 500 bytes of code.
  • 11. Navigation UP and Back - Task and Backstack - Back navigation is within Task - UP is hierarchical navigation
  • 12. Intent - Has address - Has data map: key = value - Has schema You can pass any primitive types and also serializable/Parcelable objects Used to send data/action across the system
  • 16. But what if? - Non readable - Mix of static variables - Other activities should know what target expect
  • 19. Fragment The biggest advantage and pain - .commit() asynchronous - any operation after state of Activity was saved - Getting “Context” within Fragment
  • 20. Solution - Use callbacks when possible. - Manage internal state of activity and fragment - DialogFragment special treatment
  • 21. SharedPreferences - Great thing to store persistent various. - Not accessible by other apps - Used to save things between session and session - Sometimes could be great communication tool (like intent) using “onSharedPreferenceChangeListener”
  • 23. But... - Don’t forget that each commit() is IO operation. - use Apply() instead
  • 24. Broadcast Receivers Great guy :) - Loose Coupling - 1-to-n relationship - The onReceive() method is always executed on the main thread - You can notify components in your entire application, so the communicating components do not have to "see" each other.
  • 25. But... - Marshaling data via intent really hard - Register/Unregister it when you do not needed him (BaseActivity) - Not impossible to transfer large objects