SlideShare a Scribd company logo
1 of 46
Download to read offline
Fighting Fragmentation with Fragments
     Optimizing Android apps for Honeycomb and beyond

                      Andreas Grunewald
                           Nov 2011
                      Barcamp Saskatoon
Andreas Grunewald
               http://grunewaldsrobots.com


goo.gl/b3bu6
iOS Development is
so much more awesome than
   Android Developmemt
Android is way too   Fragmented
Android is a mess, say developers
                            - Fortune
Android Fragmentation: a
            real problem, developers say
                             - Ubergizmo




Developers: Android Fragmentation
is a “Huge” Problem
                        -Slashgear
What problems do Developers see?




5. Ability to get paid. iOS leads here too, followed by BlackBerry.




                   -Forbes http://tech.fortune.cnn.com/2011/04/04/android-is-a-mess-say-developers/
What problems do Developers see?



4. App visibility. "iOS continues to lead," Baird reports, "followed by
   Blackberry, with Android still receiving poor marks in this category."
   Developers are particularly concerned about the level of "junk" apps
   in the Android ecosystem.




                   -Forbes http://tech.fortune.cnn.com/2011/04/04/android-is-a-mess-say-developers/
What problems do Developers see?




3. Ease of development. iOS outscored Android, but both were
   considered far easier to develop for than, say, Research in Motion's
   (RIMM) BlackBerry OS or Nokia (NOK) Symbian.




                   -Forbes http://tech.fortune.cnn.com/2011/04/04/android-is-a-mess-say-developers/
What problems do Developers see?



2. Store fragmentation. Several developers expressed concern over
   Android app store fragmentation. "Generally," Baird reports,
   "developers seem to prefer a unified, single store experience like
   Apple's App Store."




                   -Forbes http://tech.fortune.cnn.com/2011/04/04/android-is-a-mess-say-developers/
What problems do Developers see?



1. Device fragmentation. 56% of Android developers said that
   operating system fragmentation among the various Android
   devices was a meaningful or "huge" problem, a percentage that
   actually increased over the past three months.




                  -Forbes http://tech.fortune.cnn.com/2011/04/04/android-is-a-mess-say-developers/
Android Orphans:
Visualizing a Sad History of Support




                                                                                -theunderstatement
 http://theunderstatement.com/post/11982112928/android-orphans-visualizing-a-sad-history-of-support
Current
iOS Devices
Current
Android Devices
Are we
ARE WE            ED ?
© http://www.americanprogress.org/cartoons/2008/08/081408.html
© http://emilyandroid.deviantart.com/art/Yay-we-re-doomed-173226907
Let's have a look... shall we?
Platform Dashboard (Nov 3rd)
                  2.2 & 2.3 together 85.1% of the market
                  (With 2.1 included even 95.8%)
                  Honeycomb only 1.9%

                  Platform          Codename      API Level       Distribution
                  Android 1.5       Cupcake                   3   0.9%
                  Android 1.6       Donut                     4   1.4%
                  Android 2.1       Eclair                    7   10.7%
                  Android 2.2       Froyo                     8   40.7%
                  Android 2.3 -     Gingerbread               9   0.5%
                  Android 2.3.2
                  Android 2.3.3 -                         10      43.9%
                  Android 2.3.7
                  Android 3.0       Honeycomb             11      0.1%
                  Android 3.1                             12      0.9%
                  Android 3.2                             13      0.9%
4.0 | 19.10
                   2011




                          3.2 | 15.07
                          3.1 | 10.05
                          3.0 | 22.02
Android Versions




                          2.3 | 06.12
                   2010




                          2.2 | 20.05
                          2.1 | 12.01
                          2.0 | 26.10
                          1.6 | 15.09
                   2009



                          1.5 | 30.04
                          1.1 | 09.02
                          1.0 | 23.09
                   2008
Screen Sizes / Densities (Nov 3rd)



                      89.5% Normal Screen Size
                      73.8% hdpi + 23.7% mdpi = 97.5%
So how do you do it ?
Fragments




Introduced in Android 3.0 Honeycomb. What about pre 3.0 Devices ?
The Support Package
aka Compatibility Library
What's in it ?
●   Fragment
●   FragmentManager
●


●
    FragmentTransaction
    ListFragment
                            UI
●   DialogFragment
●   LoaderManager
    Loader
                          Data
●


●   AsyncTaskLoader
●   CursorLoader
Action Bar




Android 3.0 and up only, not in Support Package for pre 3.0 devices
Fo
Help is on the way...




                                kmr
                                      eo
                                        nG
                                        i tH
                                            ub
          http://actionbarsherlock.com
Let's look at Fragments again
How do you structure an App
 (The pre Honeycomb way)
How do you structure an App
 (Honeycomb and beyond)
That doesn't look much different!?




               vs
Let's turn our phone sideways
How about Tablets ?
And of course Tablet landscape
So how many activites, fragments and layouts
                are there ?
Put it all together
So much for the theory....
Download the Demo App from the Market




                http://goo.gl/y9C6c
Patterns when using Fragments

Event Listener Interface
   ●   communication between Fragment and Activity
   ●   separation of concerns / the fragments don't know about the
       activities -> easier to reuse across Activities
Using FrameLayouts as placeholders and adding fragments
dynamically
   ●   allows hiding of the viewgroup
   ●   Fragments can be given arguments when they are needed
   ●   easier to refactor if no fragments are in layout.xml
Event Listener Interface
class MyActivity implements OnTitleListener



class TitlesFragment extends ListFragment {

 public interface OnTitleListener {
   public void onTitleSelected(int titleId);
 }

 public void addOnTitleListener(OnTitleListener onTitleListener) {
   listener = onTitleListener;
 }

  public void onListItemClick(ListView l, View v, int position, long id) {
    ...
    listener.onTitleSelected(position);
  }
...
FrameLayout
Only use for static initialization and Fragments that are always present
<fragment android:layout_height="match_parent" android:layout_weight="1"
android:id="@+id/titles" class="demo.gwr.fightfrag.fragments.TitlesFragment"
android:layout_width="0px"></fragment>


Use the framelayout for dynamic fragments, by hiding the Layout you can make the fragments
appear when they are needed
<FrameLayout android:id="@+id/chapters" android:layout_weight="1"
android:layout_width="0px" android:layout_height="match_parent"
android:visibility="gone" />
FrameLayout
FragmentManager fragMgr = getSupportFragmentManager();

ChaptersFragment chapters = (ChaptersFragment)
fragMgr.findFragmentById(R.id.chapters);

if (chapters == null){
    chapters = ChaptersFragment.newInstance(titleId);
    chapters.addOnChapterListener(this);
}

FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.replace(R.id.chapters, chapters);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
ft.commit();

View chaptersFrame = findViewById(R.id.chapters);
chaptersFrame.setVisibility(View.VISIBLE);
Resources
●   Android Developer Portal – SDK, Sample Code, Reference Docs
    http://developer.android.com
●   Commonsware – Android Ebooks, Free Sample Code
    http://commonsware.com/
●   StackOverflow – Questions and Answers
    http://stackoverflow.com/questions/tagged/android
●   Android IRC Channel
    #android-dev on freenode
People
Alexander Lucas                                      Kirill Grouchnikov
DevAdv might answer you on Stackoverflow             Android User Interface Engineer
Andy Rubin                                           Matias Duarte
The father of Android                                The creative mind behind Androids UI, Designed WebOS
Chet Haase                                           Reto Meier
Android Graphics Engineer                            Author Professional Android Development
Dan Morrill                                          Romain Guy
Android Engineer                                     Android Graphics Engineer, Androdi Wallpapers
Dianne Hackborn                                      Roman Nurik
Android Framework Engineer                           Android Developer Advocate
Ed Burnette                                          Tim Bray
Author Hello Android                                 Android Developer Advocate from Vancouver
Jake Wharton                                         Tor Norbye
Developer of Action Bar Sherlock                     Works on the ADT & Eclipse Plugin
Jean Baptiste Queru                                  Xavier Ducrohet
Android Open Source Project                          Android Developer Tools Lead

                                   Shared Google+   Circle: goo.gl/8XZbu
Thank You


Andreas Grunewald
http://grunewaldsrobots.com
Twitter: @agrunewald
Google+ http://goo.gl/IZzuS
http://www.linkedin.com/in/andreasgrunewald
http://about.me/agrunewald

More Related Content

What's hot

もし青森の女子WebデザイナーがAndroidと出会ったら。
もし青森の女子WebデザイナーがAndroidと出会ったら。もし青森の女子WebデザイナーがAndroidと出会ったら。
もし青森の女子WebデザイナーがAndroidと出会ったら。keiko kudo
 
WP02 - Windows Phone 7 Deep Dive - How to build apps today
WP02 - Windows Phone 7 Deep Dive - How to build apps todayWP02 - Windows Phone 7 Deep Dive - How to build apps today
WP02 - Windows Phone 7 Deep Dive - How to build apps todayRoberto Freato
 
Google Meet Tip (Nod Reactions - Emoji and Handrise) - Thiyagu
Google Meet Tip  (Nod Reactions - Emoji and Handrise) - ThiyaguGoogle Meet Tip  (Nod Reactions - Emoji and Handrise) - Thiyagu
Google Meet Tip (Nod Reactions - Emoji and Handrise) - ThiyaguThiyagu K
 
10 Ways Everyone Can Support the Java Community
10 Ways Everyone Can Support the Java Community10 Ways Everyone Can Support the Java Community
10 Ways Everyone Can Support the Java CommunityStephen Chin
 
Presentation for Social Media Breakfast Dallas on Instagram and Vine 8.29.13
Presentation for Social Media Breakfast Dallas on Instagram and Vine 8.29.13Presentation for Social Media Breakfast Dallas on Instagram and Vine 8.29.13
Presentation for Social Media Breakfast Dallas on Instagram and Vine 8.29.13John Sparks
 
Quick guide to google keep for android mod monstr
Quick guide to google keep for android   mod monstrQuick guide to google keep for android   mod monstr
Quick guide to google keep for android mod monstrmodmonstr
 
Gravity thinking Social Digest #24
Gravity thinking Social Digest #24Gravity thinking Social Digest #24
Gravity thinking Social Digest #24Andrew Roberts
 
3 Graphic Design Tips for Non-Designers
3 Graphic Design Tips for Non-Designers3 Graphic Design Tips for Non-Designers
3 Graphic Design Tips for Non-DesignersRam Chary Everi
 
Gassumo Outlook Android Task Synchronizer v1.0.0.7 Installation and first syn...
Gassumo Outlook Android Task Synchronizer v1.0.0.7 Installation and first syn...Gassumo Outlook Android Task Synchronizer v1.0.0.7 Installation and first syn...
Gassumo Outlook Android Task Synchronizer v1.0.0.7 Installation and first syn...David Podhola
 
Web 2.0 Resources in Adult Education Classroom
Web 2.0 Resources in Adult Education Classroom Web 2.0 Resources in Adult Education Classroom
Web 2.0 Resources in Adult Education Classroom Nell Eckersley
 
How to create an event video
How to create an event videoHow to create an event video
How to create an event videoChris Sparshott
 
Unity3D Basic Concepts by: shamal aryan
Unity3D Basic Concepts by: shamal aryan Unity3D Basic Concepts by: shamal aryan
Unity3D Basic Concepts by: shamal aryan Shamal Aryan
 
Social Media 101: Blogging 4 Ministry
Social Media 101: Blogging 4 MinistrySocial Media 101: Blogging 4 Ministry
Social Media 101: Blogging 4 MinistryMark Delgado
 
The Ring programming language version 1.10 book - Part 5 of 212
The Ring programming language version 1.10 book - Part 5 of 212The Ring programming language version 1.10 book - Part 5 of 212
The Ring programming language version 1.10 book - Part 5 of 212Mahmoud Samir Fayed
 

What's hot (20)

Basic Toolbox
Basic ToolboxBasic Toolbox
Basic Toolbox
 
もし青森の女子WebデザイナーがAndroidと出会ったら。
もし青森の女子WebデザイナーがAndroidと出会ったら。もし青森の女子WebデザイナーがAndroidと出会ったら。
もし青森の女子WebデザイナーがAndroidと出会ったら。
 
WP02 - Windows Phone 7 Deep Dive - How to build apps today
WP02 - Windows Phone 7 Deep Dive - How to build apps todayWP02 - Windows Phone 7 Deep Dive - How to build apps today
WP02 - Windows Phone 7 Deep Dive - How to build apps today
 
Google Meet Tip (Nod Reactions - Emoji and Handrise) - Thiyagu
Google Meet Tip  (Nod Reactions - Emoji and Handrise) - ThiyaguGoogle Meet Tip  (Nod Reactions - Emoji and Handrise) - Thiyagu
Google Meet Tip (Nod Reactions - Emoji and Handrise) - Thiyagu
 
10 Ways Everyone Can Support the Java Community
10 Ways Everyone Can Support the Java Community10 Ways Everyone Can Support the Java Community
10 Ways Everyone Can Support the Java Community
 
Presentation for Social Media Breakfast Dallas on Instagram and Vine 8.29.13
Presentation for Social Media Breakfast Dallas on Instagram and Vine 8.29.13Presentation for Social Media Breakfast Dallas on Instagram and Vine 8.29.13
Presentation for Social Media Breakfast Dallas on Instagram and Vine 8.29.13
 
Quick guide to google keep for android mod monstr
Quick guide to google keep for android   mod monstrQuick guide to google keep for android   mod monstr
Quick guide to google keep for android mod monstr
 
Gravity thinking Social Digest #24
Gravity thinking Social Digest #24Gravity thinking Social Digest #24
Gravity thinking Social Digest #24
 
Flutter for web
Flutter for webFlutter for web
Flutter for web
 
3 Graphic Design Tips for Non-Designers
3 Graphic Design Tips for Non-Designers3 Graphic Design Tips for Non-Designers
3 Graphic Design Tips for Non-Designers
 
Nitin's VideoSpirations!
Nitin's VideoSpirations!Nitin's VideoSpirations!
Nitin's VideoSpirations!
 
Startup Product Summit
Startup Product SummitStartup Product Summit
Startup Product Summit
 
10 tools
10 tools10 tools
10 tools
 
Gassumo Outlook Android Task Synchronizer v1.0.0.7 Installation and first syn...
Gassumo Outlook Android Task Synchronizer v1.0.0.7 Installation and first syn...Gassumo Outlook Android Task Synchronizer v1.0.0.7 Installation and first syn...
Gassumo Outlook Android Task Synchronizer v1.0.0.7 Installation and first syn...
 
Web 2.0 Resources in Adult Education Classroom
Web 2.0 Resources in Adult Education Classroom Web 2.0 Resources in Adult Education Classroom
Web 2.0 Resources in Adult Education Classroom
 
How to create an event video
How to create an event videoHow to create an event video
How to create an event video
 
Unity3D Basic Concepts by: shamal aryan
Unity3D Basic Concepts by: shamal aryan Unity3D Basic Concepts by: shamal aryan
Unity3D Basic Concepts by: shamal aryan
 
Tablet android 2.2
Tablet android 2.2Tablet android 2.2
Tablet android 2.2
 
Social Media 101: Blogging 4 Ministry
Social Media 101: Blogging 4 MinistrySocial Media 101: Blogging 4 Ministry
Social Media 101: Blogging 4 Ministry
 
The Ring programming language version 1.10 book - Part 5 of 212
The Ring programming language version 1.10 book - Part 5 of 212The Ring programming language version 1.10 book - Part 5 of 212
The Ring programming language version 1.10 book - Part 5 of 212
 

Similar to Fighting Fragmentation with Fragments

PRESENTATION ON ANDROID
PRESENTATION ON ANDROIDPRESENTATION ON ANDROID
PRESENTATION ON ANDROIDRajat Kumar
 
Day1 what is android(print)
Day1 what is android(print)Day1 what is android(print)
Day1 what is android(print)Dongchul Shin
 
Mobile devcon metrics of the mobile web
Mobile devcon   metrics of the mobile webMobile devcon   metrics of the mobile web
Mobile devcon metrics of the mobile webAvenga Germany GmbH
 
Android By Manish Seth
Android By Manish SethAndroid By Manish Seth
Android By Manish SethNitin Gupta
 
WebTech Presentation Android
WebTech Presentation AndroidWebTech Presentation Android
WebTech Presentation AndroidArtur Nowak
 
Chrome for android_devfestx
Chrome for android_devfestxChrome for android_devfestx
Chrome for android_devfestxDominic Travers
 
Android and it’s applications
Android and it’s applicationsAndroid and it’s applications
Android and it’s applicationsamee yaami
 
Presentation on Android operating system
Presentation on Android operating systemPresentation on Android operating system
Presentation on Android operating systemSalma Begum
 
Andriod (operating system)
Andriod (operating system)Andriod (operating system)
Andriod (operating system)sai praneeth
 
Common Missteps in Cross-Platform Development.pdf
Common Missteps in Cross-Platform Development.pdfCommon Missteps in Cross-Platform Development.pdf
Common Missteps in Cross-Platform Development.pdfPridesys IT Ltd.
 
Android Fundamentals & Figures of 2012
Android Fundamentals & Figures of 2012Android Fundamentals & Figures of 2012
Android Fundamentals & Figures of 2012NAILBITER
 
Android Training Course In Chandigarh
Android Training Course In ChandigarhAndroid Training Course In Chandigarh
Android Training Course In ChandigarhExcellence Academy
 
Mobile Application Development with Android
Mobile Application Development with AndroidMobile Application Development with Android
Mobile Application Development with AndroidIJAAS Team
 
Mobile Development Overview
Mobile Development OverviewMobile Development Overview
Mobile Development OverviewShawn Grimes
 

Similar to Fighting Fragmentation with Fragments (20)

PRESENTATION ON ANDROID
PRESENTATION ON ANDROIDPRESENTATION ON ANDROID
PRESENTATION ON ANDROID
 
Day1 what is android(print)
Day1 what is android(print)Day1 what is android(print)
Day1 what is android(print)
 
ANDROID
ANDROIDANDROID
ANDROID
 
Android
AndroidAndroid
Android
 
Mobile devcon metrics of the mobile web
Mobile devcon   metrics of the mobile webMobile devcon   metrics of the mobile web
Mobile devcon metrics of the mobile web
 
Pp2
Pp2Pp2
Pp2
 
Android report
Android reportAndroid report
Android report
 
Android By Manish Seth
Android By Manish SethAndroid By Manish Seth
Android By Manish Seth
 
WebTech Presentation Android
WebTech Presentation AndroidWebTech Presentation Android
WebTech Presentation Android
 
Chrome for android_devfestx
Chrome for android_devfestxChrome for android_devfestx
Chrome for android_devfestx
 
Android and it’s applications
Android and it’s applicationsAndroid and it’s applications
Android and it’s applications
 
Presentation on Android operating system
Presentation on Android operating systemPresentation on Android operating system
Presentation on Android operating system
 
Andriod (operating system)
Andriod (operating system)Andriod (operating system)
Andriod (operating system)
 
Common Missteps in Cross-Platform Development.pdf
Common Missteps in Cross-Platform Development.pdfCommon Missteps in Cross-Platform Development.pdf
Common Missteps in Cross-Platform Development.pdf
 
Android
AndroidAndroid
Android
 
Saminar ppt of
Saminar ppt ofSaminar ppt of
Saminar ppt of
 
Android Fundamentals & Figures of 2012
Android Fundamentals & Figures of 2012Android Fundamentals & Figures of 2012
Android Fundamentals & Figures of 2012
 
Android Training Course In Chandigarh
Android Training Course In ChandigarhAndroid Training Course In Chandigarh
Android Training Course In Chandigarh
 
Mobile Application Development with Android
Mobile Application Development with AndroidMobile Application Development with Android
Mobile Application Development with Android
 
Mobile Development Overview
Mobile Development OverviewMobile Development Overview
Mobile Development Overview
 

Recently uploaded

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 

Recently uploaded (20)

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 

Fighting Fragmentation with Fragments

  • 1. Fighting Fragmentation with Fragments Optimizing Android apps for Honeycomb and beyond Andreas Grunewald Nov 2011 Barcamp Saskatoon
  • 2. Andreas Grunewald http://grunewaldsrobots.com goo.gl/b3bu6
  • 3. iOS Development is so much more awesome than Android Developmemt
  • 4. Android is way too Fragmented
  • 5. Android is a mess, say developers - Fortune
  • 6. Android Fragmentation: a real problem, developers say - Ubergizmo Developers: Android Fragmentation is a “Huge” Problem -Slashgear
  • 7. What problems do Developers see? 5. Ability to get paid. iOS leads here too, followed by BlackBerry. -Forbes http://tech.fortune.cnn.com/2011/04/04/android-is-a-mess-say-developers/
  • 8. What problems do Developers see? 4. App visibility. "iOS continues to lead," Baird reports, "followed by Blackberry, with Android still receiving poor marks in this category." Developers are particularly concerned about the level of "junk" apps in the Android ecosystem. -Forbes http://tech.fortune.cnn.com/2011/04/04/android-is-a-mess-say-developers/
  • 9. What problems do Developers see? 3. Ease of development. iOS outscored Android, but both were considered far easier to develop for than, say, Research in Motion's (RIMM) BlackBerry OS or Nokia (NOK) Symbian. -Forbes http://tech.fortune.cnn.com/2011/04/04/android-is-a-mess-say-developers/
  • 10. What problems do Developers see? 2. Store fragmentation. Several developers expressed concern over Android app store fragmentation. "Generally," Baird reports, "developers seem to prefer a unified, single store experience like Apple's App Store." -Forbes http://tech.fortune.cnn.com/2011/04/04/android-is-a-mess-say-developers/
  • 11. What problems do Developers see? 1. Device fragmentation. 56% of Android developers said that operating system fragmentation among the various Android devices was a meaningful or "huge" problem, a percentage that actually increased over the past three months. -Forbes http://tech.fortune.cnn.com/2011/04/04/android-is-a-mess-say-developers/
  • 12. Android Orphans: Visualizing a Sad History of Support -theunderstatement http://theunderstatement.com/post/11982112928/android-orphans-visualizing-a-sad-history-of-support
  • 18.
  • 19. Let's have a look... shall we?
  • 20. Platform Dashboard (Nov 3rd) 2.2 & 2.3 together 85.1% of the market (With 2.1 included even 95.8%) Honeycomb only 1.9% Platform Codename API Level Distribution Android 1.5 Cupcake 3 0.9% Android 1.6 Donut 4 1.4% Android 2.1 Eclair 7 10.7% Android 2.2 Froyo 8 40.7% Android 2.3 - Gingerbread 9 0.5% Android 2.3.2 Android 2.3.3 - 10 43.9% Android 2.3.7 Android 3.0 Honeycomb 11 0.1% Android 3.1 12 0.9% Android 3.2 13 0.9%
  • 21. 4.0 | 19.10 2011 3.2 | 15.07 3.1 | 10.05 3.0 | 22.02 Android Versions 2.3 | 06.12 2010 2.2 | 20.05 2.1 | 12.01 2.0 | 26.10 1.6 | 15.09 2009 1.5 | 30.04 1.1 | 09.02 1.0 | 23.09 2008
  • 22. Screen Sizes / Densities (Nov 3rd) 89.5% Normal Screen Size 73.8% hdpi + 23.7% mdpi = 97.5%
  • 23. So how do you do it ?
  • 24. Fragments Introduced in Android 3.0 Honeycomb. What about pre 3.0 Devices ?
  • 25. The Support Package aka Compatibility Library
  • 26. What's in it ? ● Fragment ● FragmentManager ● ● FragmentTransaction ListFragment UI ● DialogFragment ● LoaderManager Loader Data ● ● AsyncTaskLoader ● CursorLoader
  • 27. Action Bar Android 3.0 and up only, not in Support Package for pre 3.0 devices
  • 28. Fo Help is on the way... kmr eo nG i tH ub http://actionbarsherlock.com
  • 29. Let's look at Fragments again
  • 30. How do you structure an App (The pre Honeycomb way)
  • 31. How do you structure an App (Honeycomb and beyond)
  • 32. That doesn't look much different!? vs
  • 33. Let's turn our phone sideways
  • 35. And of course Tablet landscape
  • 36. So how many activites, fragments and layouts are there ?
  • 37. Put it all together
  • 38. So much for the theory....
  • 39. Download the Demo App from the Market http://goo.gl/y9C6c
  • 40. Patterns when using Fragments Event Listener Interface ● communication between Fragment and Activity ● separation of concerns / the fragments don't know about the activities -> easier to reuse across Activities Using FrameLayouts as placeholders and adding fragments dynamically ● allows hiding of the viewgroup ● Fragments can be given arguments when they are needed ● easier to refactor if no fragments are in layout.xml
  • 41. Event Listener Interface class MyActivity implements OnTitleListener class TitlesFragment extends ListFragment { public interface OnTitleListener { public void onTitleSelected(int titleId); } public void addOnTitleListener(OnTitleListener onTitleListener) { listener = onTitleListener; } public void onListItemClick(ListView l, View v, int position, long id) { ... listener.onTitleSelected(position); } ...
  • 42. FrameLayout Only use for static initialization and Fragments that are always present <fragment android:layout_height="match_parent" android:layout_weight="1" android:id="@+id/titles" class="demo.gwr.fightfrag.fragments.TitlesFragment" android:layout_width="0px"></fragment> Use the framelayout for dynamic fragments, by hiding the Layout you can make the fragments appear when they are needed <FrameLayout android:id="@+id/chapters" android:layout_weight="1" android:layout_width="0px" android:layout_height="match_parent" android:visibility="gone" />
  • 43. FrameLayout FragmentManager fragMgr = getSupportFragmentManager(); ChaptersFragment chapters = (ChaptersFragment) fragMgr.findFragmentById(R.id.chapters); if (chapters == null){ chapters = ChaptersFragment.newInstance(titleId); chapters.addOnChapterListener(this); } FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.chapters, chapters); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.commit(); View chaptersFrame = findViewById(R.id.chapters); chaptersFrame.setVisibility(View.VISIBLE);
  • 44. Resources ● Android Developer Portal – SDK, Sample Code, Reference Docs http://developer.android.com ● Commonsware – Android Ebooks, Free Sample Code http://commonsware.com/ ● StackOverflow – Questions and Answers http://stackoverflow.com/questions/tagged/android ● Android IRC Channel #android-dev on freenode
  • 45. People Alexander Lucas Kirill Grouchnikov DevAdv might answer you on Stackoverflow Android User Interface Engineer Andy Rubin Matias Duarte The father of Android The creative mind behind Androids UI, Designed WebOS Chet Haase Reto Meier Android Graphics Engineer Author Professional Android Development Dan Morrill Romain Guy Android Engineer Android Graphics Engineer, Androdi Wallpapers Dianne Hackborn Roman Nurik Android Framework Engineer Android Developer Advocate Ed Burnette Tim Bray Author Hello Android Android Developer Advocate from Vancouver Jake Wharton Tor Norbye Developer of Action Bar Sherlock Works on the ADT & Eclipse Plugin Jean Baptiste Queru Xavier Ducrohet Android Open Source Project Android Developer Tools Lead Shared Google+ Circle: goo.gl/8XZbu
  • 46. Thank You Andreas Grunewald http://grunewaldsrobots.com Twitter: @agrunewald Google+ http://goo.gl/IZzuS http://www.linkedin.com/in/andreasgrunewald http://about.me/agrunewald