$30 off During Our Annual Pro Sale. View Details »

Android: Cool Kid on the Block

Android: Cool Kid on the Block

Motivational Crash course to start with Android development for Students

Alexey Buzdin

March 19, 2015

More Decks by Alexey Buzdin

Other Decks in Programming


  1. Android “Cool Kid on the Block!”

  2. Alexey Buzdin

  3. Mobile PCor ?

  4. 4

  5. 5

  6. None
  7. Number of mobile phones to exceed world population by 2014

    http://www.digitaltrends.com/mobile/mobile-phone-world-population-2014/ iOS and Android - 1 million+ apps
  8. How do we choose a cell phone? Software vs Hardware


  10. CRITERIA OS Size Speed Battery Display Camera Popularity

  11. Mobile OS

  12. MeeGo iOS Android Windows Phone FirefoxOS BlackBerryOS Symbian bada webOS

    Sailfish OS Ubuntu Tizen Mobile OS
  13. MeeGo iOS Android Windows Phone FirefoxOS BlackBerryOS Symbian bada webOS

    Sailfish OS Ubuntu Tizen Mobile OS
  14. 14

  15. None
  16. Why choose Android?

  17. None
  18. Android Pros Free license Google support Open Source No Small

    Market Censorship Lots of powered devices o Prices o Size o Hardware
  19. Androiders Acer HTC ZTE Samsung Asus LG Motorola Panasonic Sony

    Alcatel Dell Huawei Lenovo Amazon Archos Prestigio Alibaba
  20. 20 Android where?

  21. None
  22. Android Cons Free license Google support Open Source No Small

    Market Censorship Lots of powered devices o Prices o Size o Hardware
  23. Lots of Devices

  24. 24

  25. VS

  26. None
  27. Versioning

  28. None
  29. Version Statistics March 2015

  30. Forking

  31. HTC Sense

  32. TouchWiz

  33. MotoBlur

  34. Kindle

  35. Solution to Forking?

  36. None
  37. or

  38. Nexus / Google Play edition

  39. Android Summary • Variety • Cheap/er alternative • Constantly growing/

    improving • Open for modification • Though to choose the right Android • If wrong, suffer from lags and slowness
  40. 40

  41. 41 Android Studio • IntelliJ IDEA based • Gradle build

    support • Comes with Android SDK • Layout editor with preview • Numerous plugin and much more…
  42. Android platform • Android is a Linux-based operating system and

    a software stack designed for touchscreen mobile devices
  43. Android Anatomy

  44. Android Runtime • On Android you develop in Java •

    ... but Android does not run Java Bytecode !
  45. Android Runtime • Custom Virtual Machine. Why? Constraints Designed for

    64M RAM No swap Phone tech v. Desktop CPU specific Oracle JVM problems Memory Hog Slow startup IP licensing restrictions
  46. Anatomy of Android application • AndroidManifest • Activities • Fragments

    • Intents • Services • Content providers • Broadcast receivers
  47. Android Manifest • general configuration for your application • contains

    all component definitions of your appication
  48. Activity • An activity represents a single screen with a

    user interface • An activity is implemented as a subclass of Activity
  49. Fragment • A Fragment represents a behavior or a portion

    of user interface in an Activity • Affected by lifecycle of Activity • subclass of Fragment
  50. Intent Intent is used to invoke different components: • Start

    a service • Launch an activity • Display a web page • Broadcast a message
  51. Service • Background process that performs long- running operations or

    remote processes • No user interface for service • A service is implemented as a subclass of Service • Service can be local (accessed within application) or remote (scope of device)
  52. Content providers • Content providers are used to share data

    between applications • Can store data in SQLite, Web and other storages and perform CRUD operations with Content providers • subclass of ContentProvider
  53. Broadcast receiver • Component that responds to system-wide broadcast announcements

    (e.g.. Screen is turns on-off, SMS received, • Broadcast delivered as Intent • Don’t have user interface • Subclass of BroadcastReceiver
  54. Android UI fundamentals

  55. Android UI fundamentals Screen size • actual physical size, measured

    as the screen's diagonal • 2.55”, 3.2”, 4.0”, 10.1”, ... Android groups into four generalized sizes: • Small • Normal • Large • Xlarge
  56. Android UI fundamentals Screen density • quantity of pixels within

    a physical area of the screen (dots per inch, dpi). • "low" density screen has fewer pixels • Android groups actual screen densities into four generalized densities: • Low (ldpi, 120) • Medium (mdpi, 160) • High (hdpi, 240) • Extra high (xhdpi, 320)
  57. Android UI fundamentals Density-independent pixel (dp) • virtual pixel unit

    to express layout dimensions or position in a density-independent way • equivalent to one physical pixel on a 160 dpi screen • px = dp * (dpi / 160) • system transparently handles any scaling of the dp units
  58. Android UI fundamentals Best practices • Do not use hard-coded

    pixel values in your application code • Use size and density-specific resources • Use wrap_content, match_parent, or the dp unit for layout dimensions • Test Your Application on Multiple Screens
  59. Android resources

  60. Resources Android supports the externalization of resources • strings, colors,

    images, themes, menus, layouts • system resources Why? • easier to maintain, update, and manage • easier to define alternative resource values for internationalization and to support variations in hardware
  61. res/ & R res/ • Generated by ADT Wizard •

    Each resource type is stored in a different subfolder R.java • Resources from /res are „indexed“ by ADT or aapt tool • Enables to reference resources in code
  62. Default v. Alternative Resources • For any type of resource,

    we can specify default and multiple alternative resources • Default resources are used regardless of the device configuration when no alternative resources match the current configuration • Alternative resources are designed for use with a specific configuration
  63. How to specify Alternative Resources • Create a new directory

    in res/ • res/<resources_name>- <config_qualifier> • <config_qualifier> specifies a configuration for which these resources are to be used • Save your alternative resources in new directory and name it as the default resource files
  64. Resource types • Layouts • Simple values – Strings –

    Plurals – Colors – Dimensions – Styles – String or integer arrays Stored within XML files in the res/values folder
  65. Resource types Styles and Themes • Let your applications maintain

    a consistent look and feel by enabling you to specify the attribute values used by Views • The most common use of is to store the colors and fonts for an application
  66. Building User Interfaces

  67. View View • base class for all visual interface elements

    controls, widgets • an object that draws something on the screen that the user can interact with View Group • extends View class • an object that holds other Views 
 View group is an invisible container that organizes child views, while the child views draw some part of the UI
  68. Android Layouts • A layout defines the visual structure for

    a user interface, such as the UI for an activity or app widget. • Can be defined in XML or programmatically during runtime. • XML layouts stored in res/ layout folder and are qualified as resource
  69. Layout Advantages of declaring UI in XML • Separation of

    the presentation from the code that controls its behavior • modify UI without having to modify source code • create XML layouts for different screen orientations, different device screen sizes, and different languages • Easier to visualize the structure of your UI • Easier to design/debug UI • Visualizer tool (ADT)
  70. Layout example ViewGroup View

  71. Layout types LinearLayout • Aligns all children in a single

    direction - vertically or horizontally • All children are stacked one after the other • Layout weight (android:layout_weight) assigns an "importance" value to a view in terms of how much space is should occupy on the screen
  72. LinearLayout

  73. Layout types RelativeLayout • view group that displays child views

    in relative positions • can eliminate nested view groups and keep your layout hierarchy flat, that improves performance • specify the location of child objects relative to each other (child A to the left of child B) or to the parent
  74. Basic widget toolbox

  75. www.coursera.org www.edx.org www.udacity.com

  76. 76 https://www.udacity.com/course/ud853 http://developerstudyjams.com

  77. None
  78. None
  79. Countries Chapters Events 106 601 3222

  80. gdgriga.lv

  81. None
  82. https://developers.google.com/groups/ Find us at

  83. March 26th

  84. 19.00 - 19.15 - "Retrospective of GDG Riga in 2014”

    by http://ej.uz/GDG_Riga_One_Year 19.15 - 20.00 - "Innovations and the Digital World” by from Google Lithuania 20.00 - 20.15 - Coffee Pause 20.15 - 21.00 - "Coolest Android gadgets of 2014!” by from kursors.lv
  85. May 28 - 29, 2015 https://events.google.com/io2015/

  86. May 28 - 29, 2015 https://www.youtube.com/watch?v=ksvdvCDO7pA

  87. None