Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Android 101

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
Tweet

More Decks by Pranay Airan

Other Decks in Technology

Transcript

  1. 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
  2. Why Android 1 Billion + Android device activated till now

    Content by Blrdroid under CC BY-NC 3.0
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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
  11. 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
  12. •  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
  13. 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
  14. Action Bar Text View Image View List View Image Button

    UI Elements Content by Blrdroid under CC BY-NC 3.0
  15. Understanding Views and ViewGroups Linear Layout Relative Layout Web View

    Common Layouts Content by Google under CC by 3.0
  16. 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
  17. 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
  18. 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
  19. 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
  20. UI design and the mobile touch environment Considerations When Designing

    for Android Touch Mobility Heterogeneity Content by Google under CC by 3.0
  21. 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
  22. 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
  23. 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
  24. 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
  25. 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
  26. 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
  27. 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