Download presentation
Presentation is loading. Please wait.
Published byGwendolyn Wheatley Modified over 10 years ago
1
Tackling Android Fragmentation Dev:Mobile 2012 @Glennbech, Inmeta consulting 16 klocs – not rocket science
2
Source: Twitter / http://en.wikipedia.org/wiki/Mobile_operating_system#Market_sharehttp://en.wikipedia.org/wiki/Mobile_operating_system#Market_share
7
HTC 3G SLIDE On sale May 2010 Got Gingerbread May 2011 X
8
Android ICS 7.3% (All versions) Honeycomb 2.7% Gingerbread (2.3) dominant @ 65% Froyo (2.2) still at 19.1 % As of February 2012 Phones with no ICS upgrade plan still sold This will continue iOS 61% on iOS 5 or above in 15. days! Source: http://developer.android.com/resources/dashboard/platform-versions.htmlhttp://developer.android.com/resources/dashboard/platform-versions.html
9
WHO CARES?
12
«Prove that it is feasable, and not overly difficult to, write single APK, native android apps that works well across android versions and form factors»
13
ICS/ Honeycomb tabs ActionBar & Home Navigation Action Items ViewPager https://play.google.com/store/apps/details?id=com.glennbech.nutrinfo
14
Contextual Actionbar https://play.google.com/store/apps/details?id=com.glennbech.nutrinfo Tab Navigation … with ListView multiselect
15
https://play.google.com/store/apps/details?id=com.glennbech.nutrinfo
17
Android ICS 7.3% (All versions) Honeycomb 2.7% Gingerbread (2.3) dominant @ 65% Froyo (2.2) still at 19.1 % As of February 2012 Phones with no ICS upgrade plan still sold This will continue iOS 61% on iOS 5 or above in 15. days! Source: http://developer.android.com/resources/dashboard/platform-versions.htmlhttp://developer.android.com/resources/dashboard/platform-versions.html
18
<uses-sdk android:minSdkVersion=”7" android:targetSdkVersion="14” />
19
public class TargetSDKVersionExample extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu, menu); return true; }
20
<item android:id="@+id/menu_save« android:icon="@drawable/ic_menu_save" android:title="@string/menu_save" android:showAsAction="ifRoom|withText" />
21
ICS Gingrerbread
22
<uses-sdk android:minSdkVersion=”7" android:targetSdkVersion="10” />
23
ICS Gingrerbread
24
Official Android 3 & 4 features backported Very simple to use; download using SDK manager and include JAR file in project Includes Fragment API & DialogFragment Loader API ViewPager, Pager Adapter & FragmentPagerAdapter SearchView Simple Actionbar implementation provided in samples source: http://developer.android.com/sdk/compatibility-library.html#SettingUphttp://developer.android.com/sdk/compatibility-library.html#SettingUp
25
No action bar Code «infection» Cannot extend MapActivity since you have to extends custom Activity class
26
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 / ActionMode The ICS feature "split action bar“ Plugin for MapActvity (!) www.actionbarsherlock.com Apache License Version 2.0
30
We have used the support libraries, through ActionBarSherlock to get ICS looking apps on pre-ICS phones (back to 1.6 supported) The price Must use a custom theme Must extends SherlockActivity classes Must use overloaded methods, and use getSuppportMenuInflater() etc.
32
WHAT Introduced in Android 3.0 Reusable UI components Have their own lifecycle Can add their own items to actionbar etc. WHY Code Reuse Fragments are integrated into the ICS SDK
33
http://developer.android.com/guide/topics/fundamentals/fragments.html
34
Actionbar uses TabListeners for tab navigation onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) Source: http://developer.android.com/reference/android/app/ActionBar.TabListener.htmlhttp://developer.android.com/reference/android/app/ActionBar.TabListener.html
35
Declared in layout Added/removed from code using FragmentManager
38
HTC Sensation Button (100dpx 100dp)
39
Samsung Galaxy Tab 10.1
40
Huawei IDEOS
41
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
42
Excellent support for providing resources based on device configuration Versions mcc310- mnc004 (US/Verizon) Car/desk (docking) Night mode ETC Source: http://developer.android.com/guide/topics/resources/providing-resources.htmlhttp://developer.android.com/guide/topics/resources/providing-resources.html
43
Provide differnet layout for different screens and orientations - backed by the same activity Provide a different Activity class for a different device/layout. Example one for phone and one for tablet
45
Dispatch Activity (condition) Phone Activity Tablet Activity Intent New Intent
47
The Android OS and devices are both forward- and backwards compatible in regard to OS versions Android has excellent support for layout on devices with different screen sizes and densities By using the ActionbarSherlock/Fragment activities you can write code that use fragments and deploy on tablets and phones By using ActionbarSherlock you can get the «ICS look» on your Android 1.X + devices today. Including the kindle fire.
48
“I am an old man and have known a great many troubles, but most of them never happened” – Mark Twain
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.