9. What do I need to know to be a programmer?
•
OOP (Object Oriented Programming)
•
Encapsulation, Inheritance,
Polymorphism
•
Interfaces
•
Listeners
•
Packages structure
9
12. Four pillars of Android
•
Activities
•
Services
•
Broadcast Receivers
•
Content Providers
12
13. Activities
•
Activity is the main component of Android, represent
a single screen whit a user interface
•
Is like a form in traditional languages such as Visual
Basic or like a single HTML page
13
15. Introduction to Intents
•
•
•
Intents are used as a message-passing mechanism
that works both within your application, and between
applications.
Interacts with every components in Android
Used for:
•
•
•
Declare your intention that an Activity or Service be started to perform an
action, usually with a piece of data ( startActivity(Intent); )
Broadcast that an event (or action) has occurred
Explicity start a particular Service or Activity
15
16. Services
•
•
•
•
Application components that can perform longrunning operations in the background
Doesn’t provide a user interface
Service is not a separate process or thread
Service is a simple class, you must implement
separate threads by yourself
16
18. Broadcast Receiver
•
A Broadcast receiver is a component that does nothing
but receive and react to broadcast announcements
•
Broadcast Intent
•
Your app can:
•
•
•
Receive and react to system services (ex. Battery low)
Receive and react to other apps broadcast announcements
Initiate broadcasts to other apps
18
19. Content Provider
•
•
•
•
•
•
Content Providers manage access to a structured set of
data
Are the standard interface that connects data in one
process with code running in another process
Any application with appropriate permission, can read and
write the data
Files, SQL Database
Expose a public URI that uniquely identifies its data set
“content://…”
19
34. Fragments
•
Since Android 3.0
•
Represent a portion of the UI in an activity
•
Can combine multiple fragment in a single activity
•
Have their lifecycle
•
Live in a ViewGroup
34
36. Resources
•
•
•
Any other information that are not code
Stored in config files external to code (but inside the final
apk package)
Contain
•
•
•
•
Drawable
Layouts
Xml
Values
36
37. Classe R.java
•
Bridge between activities and resources
•
In gen/
•
Dynamically generated (by Android’s Eclipse plugin) and
contains numeric constant referred to every resources of
the project
•
Contains only public fields (“public static final”)
37
38. Resource Example
String.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
XML
<string name="app_name">Test</string>
<string name="action_settings" >Settings</string>
<string name="hello_world" >Hello world!</string>
</resources>
38
44. Views
•
Base component for UI (Widget)
•
Layout
•
View Groups
•
•
Visual structure of the UI
Invisible Container that contains other View or ViewGroup
44
45. Manifest
•
Contains the essential information about the application
•
Other elements to declare
•
•
•
•
•
Version
Name
Icon
Permission
Features
•
•
•
•
•
•
Activity
Services
Provider
Receiver
uses-sdk
uses-permission
45
46. Design Pattern
•
Model – View – Controller
•
Model – View – Presenter
•
In the official Android documentations doesn’t exists any
referral to these patterns
•
•
Activity -> Controller
Activity -> View
46
51. Suggestions (No Panic!)
•
Choose the right target of your application
•
•
•
•
Learn how to use correctly the res.
Support library
Test on at least two devices
Fragmentation can be an advantage
•
minSdkVersion=“14”
51