1 / 48

Tackling Android Fragmentation Dev : Mobile 2012 @ Glennbech , Inmeta consulting

Tackling Android Fragmentation Dev : Mobile 2012 @ Glennbech , Inmeta consulting. 16 klocs – not rocket science. Source: Twitter / http ://en.wikipedia.org/wiki/Mobile_operating_system#Market_share. Nairobi. HTC 3G SLIDE. X. Got Gingerbread May 2011. On sale May 2010.

yadid
Download Presentation

Tackling Android Fragmentation Dev : Mobile 2012 @ Glennbech , Inmeta consulting

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. TacklingAndroid FragmentationDev:Mobile 2012 @Glennbech , Inmeta consulting 16 klocs – not rocket science

  2. Source: Twitter / http://en.wikipedia.org/wiki/Mobile_operating_system#Market_share

  3. Nairobi

  4. HTC 3G SLIDE X Got GingerbreadMay 2011 On saleMay 2010

  5. Situation report June 2012 Android • ICS 7.3% (All versions) • Honeycomb 2.7% • Gingerbread (2.3) dominant @ 65% • Froyo (2.2) still at 19.1 % • As ofFebruary 2012 Phones withno ICS upgrade plan still sold • This willcontinue iOS • 61% oniOS 5 or above in 15. days! Source: http://developer.android.com/resources/dashboard/platform-versions.html

  6. WHO CARES?

  7. Agenda «Prove that it is feasable, and not overlydifficult to, write single APK, native androidappsthatworkswellacrossandroidversions and form factors»

  8. ActionBar& HomeNavigation ICS/Honeycomb tabs ViewPager Action Items https://play.google.com/store/apps/details?id=com.glennbech.nutrinfo

  9. ContextualActionbar Tab Navigation … withListViewmultiselect https://play.google.com/store/apps/details?id=com.glennbech.nutrinfo

  10. https://play.google.com/store/apps/details?id=com.glennbech.nutrinfohttps://play.google.com/store/apps/details?id=com.glennbech.nutrinfo

  11. Android versions

  12. Situation report June 2012 Android • ICS 7.3% (All versions) • Honeycomb 2.7% • Gingerbread (2.3) dominant @ 65% • Froyo (2.2) still at 19.1 % • As ofFebruary 2012 Phones withno ICS upgrade plan still sold • This willcontinue iOS • 61% oniOS 5 or above in 15. days! Source: http://developer.android.com/resources/dashboard/platform-versions.html

  13. Androidmanifest.xml <uses-sdk android:minSdkVersion=”7" android:targetSdkVersion="14” />

  14. Example. Helloworld publicclassTargetSDKVersionExampleextends Activity { publicvoidonCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override publicbooleanonCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu, menu); return true; } }

  15. Example. Menu.xml <menu> <item android:id="@+id/menu_save« android:icon="@drawable/ic_menu_save" android:title="@string/menu_save" android:showAsAction="ifRoom|withText" /> </menu>

  16. ICS Gingrerbread

  17. Androidmanifest.xml <uses-sdk android:minSdkVersion=”7" android:targetSdkVersion="10” />

  18. ICS Gingrerbread

  19. Android Support Libraries • Official Android 3 & 4 featuresbackported • Very simple to use; downloadusing SDK manager and include JAR file in projectIncludes • Fragment API & DialogFragment • Loader API • ViewPager, Pager Adapter & FragmentPagerAdapter • SearchView • Simple Actionbarimplementationprovided in samples source: http://developer.android.com/sdk/compatibility-library.html#SettingUp

  20. Limitationsofthe support libraries • No action bar • Code «infection» • CannotextendMapActivitysinceyou have to extendscustom Activity class

  21. ActionbarSherlock • Written by Jake Whorton • Easy to use (git clone) • Includes & based on support libraries • Elaborate. Support for wide range of Honeycomb and ICS features • Actionbar • Navigation Modes, Tabs and spinners in the action bar. • Contextual Action Bar / ActionModeThe ICS feature "split action bar“ • Pluginfor MapActvity(!) • www.actionbarsherlock.com • Apache License Version 2.0

  22. ActionbarSherlock #1 IDE

  23. Helloworld

  24. A quicksummary • We have used the support libraries, throughActionBarSherlock to get ICS lookingappson pre-ICS phones (back to 1.6 supported) • The price • Must use a customtheme • Must extendsSherlockActivityclasses • Must useoverloadedmethods, and usegetSuppportMenuInflater() etc.

  25. Fragments

  26. Fragments crashcourse WHAT • Introducedin Android 3.0 • Reusable UI components • Have theirownlifecycle • Canaddtheirownitems to actionbar etc. WHY • Code Reuse • Fragments areintegratedintothe ICS SDK

  27. Why - Reuse http://developer.android.com/guide/topics/fundamentals/fragments.html

  28. onTabSelected(ActionBar.Tabtab, FragmentTransactionft) ActionbarusesTabListeners for tab navigation Source: http://developer.android.com/reference/android/app/ActionBar.TabListener.html

  29. Using fragments - example • Declared in layout • Added/removed from code using FragmentManager

  30. Extreme clientprogramming

  31. Density and Size

  32. Button (100dpx100dp) HTC Sensation

  33. Samsung Galaxy Tab 10.1

  34. Huawei IDEOS

  35. Definitions • xlarge screens are at least 960dp x 720dp. • large screens are at least 640dp x 480dp. • normal screens are at least 470dp x 320dp. • small screens are at least 426dp x 320dp

  36. Best Match layout picking • Excellent support for providing resourcesbasedondeviceconfiguration • Versions • mcc310-mnc004(US/Verizon) • Car/desk (docking) • Night mode • ETC Source: http://developer.android.com/guide/topics/resources/providing-resources.html

  37. In practice • Providediffernet layout for different screens and orientations - backed by the same activity • Provide a different Activity class for a different device/layout. Exampleone for phone and one for tablet

  38. Dispatch Activity idiom PhoneActivity New Intent DispatchActivity (condition) Intent TabletActivity New Intent

  39. Conclusion • The Android OS and devicesareboth forward- and backwardscompatible in regard to OS versions • Android has excellent support for layout ondeviceswith different screen sizes and densities • By usingtheActionbarSherlock/Fragment activitiesyoucanwritecodethatuse fragments and deployontablets and phones • By usingActionbarSherlockyoucangetthe «ICS look» onyour Android 1.X + devicestoday. Includingthekindle fire.

  40. “I am an old man and have known a great many troubles, but most of them never happened” – Mark Twain

More Related