Share
Embed
Android 101
Get Started With Android Application development. This slide deck is used for Bangalore Android User Group Teach Program.
Learn about the basics of Android
Building blocks of Android App
How to design good android app
Pranay Airan
April 14, 2013
Transcript
65 slides
-
Pranay Airan Web application developer @Intuit Android Developer by choice
J Assistant organizer Blrdroid @pranayairan -
Bangalore Android User Group ( www.BlrDroid.org) Largest open Android developer
in the world. Over 4300 members 30 meetups 12 Teach Events 4 hackathons Active participation in events like Droidcon, Global Android Developer hackathon etc -
Why Android 2 million Android device activation per day Content
by Blrdroid under CC BY-NC 3.0 -
Why Android 1 Billion + Android device activated till now
Content by Blrdroid under CC BY-NC 3.0 -
Why Android 80% Android market share world wide Content by
Blrdroid under CC BY-NC 3.0 -
Anatomy of an Android app Linux Kernel Libraries & Davlik
Virtual Machine Application Framework Applications (Built-in & Custom) Content by Google under CC by 3.0 -
Anatomy of an Android app • Runs inside a sandbox
as a separate UID (Linux User ID). • Framework restricts access. • Privileges can be requested for additional access. Android App Security Content by Google under CC by 3.0 -
Android project folder structure • AndroidManifest.xml - Fundamental characteristics of
your app • src/main/res - Directory for your app's main source files • src/res/ - Contains several sub-directories for app resources • drawable-hdpi/ - Directory for drawable objects, designed for a specific screen • layout/ - Directory for files that define your app's user interface • values/ - Directory for other XML files that contain a collection of resources Android Project Folder Structure Content by Google under CC by 3.0 -
Android project folder structure App Resources PNGs, 9-patch PNGs, optimized
for multiple densities Layout XML optimized for physical screen size and orientation Strings XML localized for your target regions Drawable XML Strings, styles, themes, etc. Styles, themes varying by API level res/ drawable drawable-xhdpi drawable-hdpi drawable-mdpi layout layout-land layout-large layout-large-land values values-v11 values-v14 values-en Content by Google under CC by 3.0 -
Lesson 2: Android Application Types & Fundamental Classes Content by
Google under CC by 3.0 -
Android Manifest File Activities Intents Services Views Content Providers BroadCast
Receiver Content by Blrdroid under CC BY-NC 3.0 -
Activities Android Manifest File Intents Services Views Content Providers BroadCast
Receiver Content by Blrdroid under CC BY-NC 3.0 -
Activities • Provides a screen with which users can interact
• Activity has UI. • An app usually consists of multiple activities • 1 Activity is always main. • Activity has lifecycle Content by Blrdroid under CC BY-NC 3.0 -
Intents Activities Android Manifest File Services Views Content Providers BroadCast
Receiver Content by Blrdroid under CC BY-NC 3.0 -
Intents Intents are simple message objects which are use to
move from 1 activity to another Intent defines “intention” of what application want Intents can be use to communicate from 1 application to another Content by Blrdroid under CC BY-NC 3.0 -
Activities Android Manifest File Intents Services Views Content Providers BroadCast
Receiver Content by Blrdroid under CC BY-NC 3.0 -
Services • Use to perform long running tasks in the
background • No User interface • Runs in the background for certain amount of time • Use in combination with broadcast often to perform heavy operations like file upload sync etc Content by Blrdroid under CC BY-NC 3.0 -
Activities Android Manifest File Intents Views Services Content Providers BroadCast
Receiver Content by Blrdroid under CC BY-NC 3.0 -
Android Manifest It names the Java package for the application.
Components of the application — the activities, services etc Permissions Lists the library And more Content by Blrdroid under CC BY-NC 3.0 -
AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest ...> <uses-feature ... /> <uses-permission
... /> <uses-sdk android:minSdkVersion="3" android:targetSdkVersion="5" android:maxSdkVersion="5" /> <application ...> <activity ...> ... </activity> <service ...> ... </service> <provider ...> ... </provider> <receiver ...> ... </receiver> </application> </manifest> Content by Google under CC by 3.0 -
Activities Android Manifest File Intents Services Views Content Providers BroadCast
Receiver Content by Blrdroid under CC BY-NC 3.0 -
• Ordered list of Views and ViewGroups • Positions and
sizes child views and layouts Views and ViewGroups Reusable individual UI components Optionally interactive (clickable/ focusable/etc.) Organized as trees to build up GUIs Described in XML in layout resources Views ViewGroups Content by Google under CC by 3.0 -
Understanding Views and ViewGroups How Views and ViewGroups Apply to
Activities <view group> <view group> <view> <view group> <view> <view> Content by Google under CC by 3.0 -
Action Bar Text View Image View List View Image Button
UI Elements Content by Blrdroid under CC BY-NC 3.0 -
Understanding Views and ViewGroups Linear Layout Relative Layout Web View
Common Layouts Content by Google under CC by 3.0 -
Understanding Views and ViewGroups AdapterView List View Grid View Content
by Google under CC by 3.0 -
The Android user interface XML and resources <ScrollView android:layout_width="match_parent" android:layout_height="match_parent">
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="16dp"> <EditText android:id="@+id/email" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/prompt_email" android:inputType="textEmailAddress" android:singleLine="true" /> <EditText android:id="@+id/password" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/prompt_password" android:inputType="textPassword” android:singleLine="true" /> <Button android:id="@+id/sign_in_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right" android:layout_marginTop="16dp" android:paddingLeft="32dp" android:paddingRight="32dp" android:text="@string/action_sign_in_register" /> </LinearLayout> </ScrollView> Content by Google under CC by 3.0 -
The Android user interface XML and resources App Resources (Review)
PNGs, 9-patch PNGs, optimized for multiple densities Layout XML optimized for physical screen size and orientation Strings XML localized for your target regions Drawable XML Strings, styles, themes, etc. Styles, themes varying by API level res/ drawable drawable-xhdpi drawable-hdpi drawable-mdpi layout layout-land layout-large layout-large-land values values-v11 values-v14 values-en values-fr values-ja Content by Google under CC by 3.0 -
Activities Android Manifest File Intents Services Views Content Providers BroadCast
Receiver Content by Blrdroid under CC BY-NC 3.0 -
BroadCast Receiver BroadCast receiver is android components which allows to
register for system events Different kind of system events which do broadcast Battery low Headset plugged Location change Sms received Call received etc Content by Blrdroid under CC BY-NC 3.0 -
Notifications • Notifies users about events happening in phone •
It appears as a small icon in notification bar • User Can interact with this notifications • Sent via notification manager • Example SMS, alarm, miss call Content by Blrdroid under CC BY-NC 3.0 -
UI design and the mobile touch environment Considerations When Designing
for Android Touch Mobility Heterogeneity Content by Google under CC by 3.0 -
UI design and the mobile touch environment Key Principles of
Android UI Design “Pictures are faster than words.” “Only show what I need when I need it.” “Make the important things fast.” “Do the heavy lifting for me.” Content by Google under CC by 3.0 -
Creating a wireframe Wireframing before coding saves you time. Why
Create Wireframes? Always start with pencil and paper (or a whiteboard). Content by Google under CC by 3.0 -
Creating a wireframe Wireframe Examples Wireframe Sketches Digital Wireframe Content
by Google under CC by 3.0 -
BUILDING AN ANDROID USER INTERFACE: GETTING STARTED Quiz Questions Wireframes
help you: § Record your ideas § Assess your app from a high-level user point of view § Save you a lot of time § All of the above § None of the above Which of the following are considerations when designing for Android? 1. Mobile 2. Heterogeneity 3. Touch 4. All of the above 5. None of the above You should use your wireframes to... § Re-arrange, add, and remove interactions quickly § Scope out UI complexity § Both of the above § None of the above You should start drawing your wireframes using Keynote or Powerpoint. § True § False Content by Google under CC by 3.0 -
Resources developer.android.com Vogella http://goo.gl/aUKSJr Mykong http://goo.gl/BymmEH 200 video tutorial http://goo.gl/Msa20I
Stackoverflow Books Hello Android Basic android programming by mark murphy Content by Blrdroid under CC BY-NC 3.0 -
Content Providers • Manages access to a structured set of
data. • Encapsulates the data and provides mechanisms for defining data security. • Is a standard interface that connects data in one process with code running in another process. • You don't need to develop your wn provider if you don't intend to share your data with other applications. Content by Blrdroid under CC BY-NC 3.0 -
Sqllite db File Remote Content provider Contact App Activity 1.1
Activity 1. App 2 Activity 1.1 Activity 1. App 3 Activity 1.1 Activity 1. Content by Blrdroid under CC BY-NC 3.0 -
Generating APK Android application package file is the format to
distribute and install android app Apk can be Signed and unsigned Generating signed and unsigned apk Content by Blrdroid under CC BY-NC 3.0 -
Launch in marketplace What is required? Typical launch process Content
by Blrdroid under CC BY-NC 3.0 -
Debugging How to debug Using debug perspectives Content by Blrdroid
under CC BY-NC 3.0 -
Connecting your phone Developing without emulator Debugging in phone Content
by Blrdroid under CC BY-NC 3.0