SlideShare a Scribd company logo
Getting the Magic on Android Tablets

Suzanne Alexandra
Motorola Mobility

MOTOROLA and the Stylized M Logo are trademarks or registered trademarks of Motorola Trademark Holdings, LLC.
All other trademarks are the property of their respective owners. © 2011 Motorola Mobility, Inc. All rights reserved.
Reach me

     @suzalex #AndroidOpen

      Suzanne Alexandra

developer.motorola.com
video here
http://bit.ly/fOIw0J
″Massive technological disruptions create big
market opportunities. Tablets are clearly disrupting
numerous markets, and I think now is the right
time to place big bets on the tablet market -- and
the platform we are betting on is Android.″


                              Mark Williamson
                              CEO and Cofounder
your app ... when?
emotional
             whimsical
       beautiful
functional
first things first
Be tablet only   Take full advantage of large screens




<supports-screens
     android:smallScreens="false"
     android:normalScreens="false"
                                                3.1 and earlier
     android:largeScreens="false"
     android:xlargeScreens="true"


     android:requiresSmallestWidthDp="600" />



                        Compile with
                        3.2 and up
Be tablet and smartphone   Expand your reach




<supports-screens
     android:smallScreens="true"
     android:normalScreens="true"              3.1 and earlier
     android:largeScreens="true"
     android:xlargeScreens="true" />



<uses-sdk
    android:minSdkVersion="9"

android:targetSdkVersion="13"     />
Be tablet and smartphone   Expand your reach




                                               Use fragments




         Keep action
         bars simple
emotional
             whimsical
       beautiful
functional
now, a few patterns
what do you do
when the device turns
    upside down
up + down rotation
android:screenOrientation="landscape"




     change to sensorLandscape
android:screenOrientation="portrait"




  change to sensorPortrait ( but … )
android:screenOrientation="sensor" | "fullSensor"
emotional
             whimsical
       beautiful
functional
stacked image galleries
Getting the Magic on Android Tablets
many sources or categories
independently scrollable
content pieces equal
sources




timeline
the challenge
image size and quality
Stacked image galleries   Change image size, in a scalable way


<ImageView
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="300dp"
  android:layout_height="200dp" >
</ImageView>




                                                 150 dp by 100 dp



                                        Smartphones, 2.3+


                                        10-inch tablets, 3.2+
Stacked image galleries   Override getView()




 public View getView( int position, View convertView,
                      ViewGroup parent) {

    LayoutInflater inflater = getLayoutInflater();

    ImageView i = (ImageView) inflater.inflate(
                   R.layout.image, parent, false );

    i.setImageResource(mImageIds[position]);
    i.setScaleType(ImageView.ScaleType.FIT_XY);
    i.setBackgroundResource(mGalleryItemBackground);

    return i;
}
Stacked image galleries   Use BitmapFactory.Options




BitmapFactory.Options options = new BitmapFactory.Options();

    options.inJustDecodeBounds = false;
    options.inDither = false;
    options.inScaled = false;
    options.inPreferredConfig = Bitmap.Config.ARGB_8888;
    options.inTargetDensity = screenDensity; // 160 dpi

 Bitmap bitmap =
BitmapFactory.decodeResource(getResources(),
R.drawable.sample_0, options);
emotional
             whimsical
       beautiful
functional
hide and show fragments
Hide and show   Watch the orientation change
Hide and show   Stacking is better
Hide and show   But hiding and showing is even better
Getting the Magic on Android Tablets
Hide and show   Slide one fragment out and another in



FragmentTransaction ft =
        getFragmentManager().beginTransaction()          ;

ft.setCustomAnimations( R.anim.slide_in_left,
        R.anim.slide_out_right );

DetailsFragment newFragment = DetailsFragment.newInstance();

ft.replace( R.id.details_fragment_container,
             newFragment, "detailFragment");

// Start the animated transition.
ft.commit();
Hide and show   Or, use show() and hide()

   public void onClick(View v) {

      FragmentTransaction ft =
   getFragmentManager().beginTransaction();

         ft.setCustomAnimations(
                android.R.animator.fade_in,
                android.R.animator.fade_out);

         if ( fragment.isHidden() ) {
              ft.show(fragment);
              button.setText("Hide");
         } else {
              ft.hide(fragment);
              button.setText("Show")
         }

        ft.commit();
   }
ok.
 what was that
animation part?
Hide and show   Create an XML animation




<set>
 <objectAnimator
    xmlns:android="http://schemas.android.com/apk/res/android"
        android:duration="500"
        android:valueFrom="-1280"
        android:valueTo="0"
        android:valueType="floatType"
        android:propertyName="x" />
</set>
Hide and show   Set the custom animation




if (fragment.isHidden()) {

     ft.setCustomAnimations(
                 R.anim.infromleft, R.anim.outtoleft);

     ft.show(fragment);
     button.setText("Hide");
}
emotional
             whimsical
       beautiful
functional
so.
how do we get
 whimsical?
playfulness
sets your app apart
playfulness
  sets your app apart
engagement of the heart
flipping lists
What would it be like to shop in several languages?
Getting the Magic on Android Tablets
Flipping lists   Target API 11 or higher



<uses-sdk
   android:minSdkVersion="11"
   android:targetSdkVersion="13" />




         android.animation
Flipping lists   Use two ListView elements



<LinearLayout      … >

   <ListView
        android:id="@+id/list_en"
        android:layout_width="match_parent"
        android:layout_weight="1"
        android:layout_height="match_parent" />


   <ListView
        android:id="@+id/list_es"
        android:layout_width="match_parent"
        android:layout_weight="1"
        android:layout_height="match_parent"
        android:visibility="gone" />

</LinearLayout>
Flipping lists   And an ObjectAnimator



ObjectAnimator visToInvis =
   ObjectAnimator.ofFloat(
       visibleList, "rotationY", 0f, 90f);
   visToInvis.setDuration(500);
   visToInvis.setInterpolator(accelerator);

final ObjectAnimator invisToVis =
   ObjectAnimator.ofFloat(
       invisibleList, "rotationY", -90f, 0f);
       invisToVis.setDuration(500);
       invisToVis.setInterpolator(decelerator);
more info

animation in honeycomb
      chet haase
   http://bit.ly/grk1rI

 apidemos, animation
emotional
             whimsical
       beautiful
functional
won't you join us?

    @suzalex
    @motodev
LEGAL
LICENSE NOTICES


Except where noted, sample source code written by Motorola Mobility Inc. and provided to you is licensed as described below.
Copyright © 2010-2011, Motorola, Inc. All rights reserved except as otherwise explicitly indicated.
•     Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
•     Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
•     Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other
      materials provided with the distribution.
•     Neither the name of the Motorola, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific
      prior written permission.
•     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
      INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
      DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
      EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
      USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
      LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
      THE POSSIBILITY OF SUCH DAMAGE.


O
Other source code displayed in this presentation may be offered under other licenses.
Apache 2.0
      Copyright © 2010, Android Open Source Project. All rights reserved unless otherwise explicitly indicated.
      Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the
      License at http://www.apache.org/licenses/LICENSE-2.0.
      Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
      OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


Creative Commons 3.0 Attribution License
      Portions of this presentation are reproduced from work created and shared by Google (http://code.google.com/policies.html) and used according to terms
      described in the Creative Commons 3.0 Attribution License (http://creativecommons.org/licenses/by/3.0/).



    MOTOROLA and the Stylized M Logo are trademarks or registered trademarks of Motorola Trademark Holdings, LLC.
    All other trademarks are the property of their respective owners. © 2011 Motorola Mobility, Inc. All rights reserved.

More Related Content

PPT
Getting the Magic on Android Tablets
PDF
Android Wear Development
KEY
Design Patterns for Tablets and Smartphones
PDF
Android UI Reference
PDF
Intro to Google TV
PDF
Standford 2015 week5: 1.View Controller Lifecycle, Autolayout 2. Scroll View ...
PDF
Slightly Advanced Android Wear ;)
PDF
Top Tips for Android UIs
Getting the Magic on Android Tablets
Android Wear Development
Design Patterns for Tablets and Smartphones
Android UI Reference
Intro to Google TV
Standford 2015 week5: 1.View Controller Lifecycle, Autolayout 2. Scroll View ...
Slightly Advanced Android Wear ;)
Top Tips for Android UIs

What's hot (6)

PPTX
Android 3
PDF
What's new in Android P @ I/O Extended Bangkok 2018
DOCX
Android action bar and notifications-chapter16
PDF
Event App - Features at a glance
PDF
ILUG 2010 - Deploying plug-ins to the enterprise
DOCX
STYLISH FLOOR
Android 3
What's new in Android P @ I/O Extended Bangkok 2018
Android action bar and notifications-chapter16
Event App - Features at a glance
ILUG 2010 - Deploying plug-ins to the enterprise
STYLISH FLOOR
Ad

Similar to Getting the Magic on Android Tablets (20)

PPT
Beautifully Usable, Multiple Screens Too
PPT
Ui patterns
PDF
Top Tips for Android UIs - Getting the Magic on Tablets
PDF
Android design patterns
PDF
Android 3.0 Portland Java User Group 2011-03-15
PPTX
Introduction to Android for Quality Engineers
PDF
Android ui tips & tricks
PPTX
Fernando F. Gallego - Efficient Android Resources 101
PPTX
Android UI Tips & Tricks
PPTX
Application Development - Overview on Android OS
PDF
[PBO] Pertemuan 12 - Pemrograman Android
PPTX
Consistent UI Across Android Devices
PPTX
Material design
PDF
The Good, the Bad and the Ugly things to do with android
PDF
Android Best Practices
PDF
Introducing Honeycomb
PPT
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...
PDF
Designing and implementing_android_uis_for_phones_and_tablets
PDF
[Droidcon Paris 2013]Multi-Versioning Android Tips
PDF
Beating Android Fragmentation, Brett Duncavage
Beautifully Usable, Multiple Screens Too
Ui patterns
Top Tips for Android UIs - Getting the Magic on Tablets
Android design patterns
Android 3.0 Portland Java User Group 2011-03-15
Introduction to Android for Quality Engineers
Android ui tips & tricks
Fernando F. Gallego - Efficient Android Resources 101
Android UI Tips & Tricks
Application Development - Overview on Android OS
[PBO] Pertemuan 12 - Pemrograman Android
Consistent UI Across Android Devices
Material design
The Good, the Bad and the Ugly things to do with android
Android Best Practices
Introducing Honeycomb
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...
Designing and implementing_android_uis_for_phones_and_tablets
[Droidcon Paris 2013]Multi-Versioning Android Tips
Beating Android Fragmentation, Brett Duncavage
Ad

More from Motorola Mobility - MOTODEV (20)

PDF
HTML5 vs Native Android: Smart Enterprises for the Future
PDF
The Enterprise Dilemma: Native vs. Web
PPTX
Kill the Laptop!
PPTX
MOTODEV App Validator
PPTX
Getting Your App Discovered: Android Market & Beyond
PPT
Introducing Fragments
PDF
Taking Advantage of Webtop
PDF
Building Quality Into Your Apps Through Testing
PPT
Designing Apps for Motorla Xoom Tablet
PDF
Diseñando aplicaciones para el Motorola XOOM
PDF
Presentación de los fragmentos
PDF
Gráficos cada vez más rápidos. Cómo usar NDK y RenderScript
PDF
Consejos principales para Android UI Cómo alcanzar la magia en los tablets
PDF
Cómo agregar calidad a sus aplicaciones mediante pruebas
PDF
Cómo aprovechar Webtop Cómo HTML5 mejora la experiencia del usuario
PDF
Principais dicas para UIs do Android
PDF
Gráficos cada vez mais rápidos utilização de NDK e Renderscript
PDF
Como integrar qualidade aos seus aplicativos através de testes
PDF
Tirando vantagem do webtop como o html5 aprimora a experiência do usuário de ...
PDF
Introdução a fragmentos
HTML5 vs Native Android: Smart Enterprises for the Future
The Enterprise Dilemma: Native vs. Web
Kill the Laptop!
MOTODEV App Validator
Getting Your App Discovered: Android Market & Beyond
Introducing Fragments
Taking Advantage of Webtop
Building Quality Into Your Apps Through Testing
Designing Apps for Motorla Xoom Tablet
Diseñando aplicaciones para el Motorola XOOM
Presentación de los fragmentos
Gráficos cada vez más rápidos. Cómo usar NDK y RenderScript
Consejos principales para Android UI Cómo alcanzar la magia en los tablets
Cómo agregar calidad a sus aplicaciones mediante pruebas
Cómo aprovechar Webtop Cómo HTML5 mejora la experiencia del usuario
Principais dicas para UIs do Android
Gráficos cada vez mais rápidos utilização de NDK e Renderscript
Como integrar qualidade aos seus aplicativos através de testes
Tirando vantagem do webtop como o html5 aprimora a experiência do usuário de ...
Introdução a fragmentos

Recently uploaded (20)

PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPT
Teaching material agriculture food technology
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
KodekX | Application Modernization Development
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Approach and Philosophy of On baking technology
PPTX
A Presentation on Artificial Intelligence
The Rise and Fall of 3GPP – Time for a Sabbatical?
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Teaching material agriculture food technology
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Network Security Unit 5.pdf for BCA BBA.
Advanced methodologies resolving dimensionality complications for autism neur...
KodekX | Application Modernization Development
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Empathic Computing: Creating Shared Understanding
Per capita expenditure prediction using model stacking based on satellite ima...
NewMind AI Monthly Chronicles - July 2025
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Big Data Technologies - Introduction.pptx
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Building Integrated photovoltaic BIPV_UPV.pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Unlocking AI with Model Context Protocol (MCP)
Approach and Philosophy of On baking technology
A Presentation on Artificial Intelligence

Getting the Magic on Android Tablets

  • 1. Getting the Magic on Android Tablets Suzanne Alexandra Motorola Mobility MOTOROLA and the Stylized M Logo are trademarks or registered trademarks of Motorola Trademark Holdings, LLC. All other trademarks are the property of their respective owners. © 2011 Motorola Mobility, Inc. All rights reserved.
  • 2. Reach me @suzalex #AndroidOpen Suzanne Alexandra developer.motorola.com
  • 4. ″Massive technological disruptions create big market opportunities. Tablets are clearly disrupting numerous markets, and I think now is the right time to place big bets on the tablet market -- and the platform we are betting on is Android.″ Mark Williamson CEO and Cofounder
  • 5. your app ... when?
  • 6. emotional whimsical beautiful functional
  • 8. Be tablet only Take full advantage of large screens <supports-screens android:smallScreens="false" android:normalScreens="false" 3.1 and earlier android:largeScreens="false" android:xlargeScreens="true" android:requiresSmallestWidthDp="600" /> Compile with 3.2 and up
  • 9. Be tablet and smartphone Expand your reach <supports-screens android:smallScreens="true" android:normalScreens="true" 3.1 and earlier android:largeScreens="true" android:xlargeScreens="true" /> <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="13" />
  • 10. Be tablet and smartphone Expand your reach Use fragments Keep action bars simple
  • 11. emotional whimsical beautiful functional
  • 12. now, a few patterns
  • 13. what do you do when the device turns upside down
  • 14. up + down rotation
  • 15. android:screenOrientation="landscape" change to sensorLandscape
  • 16. android:screenOrientation="portrait" change to sensorPortrait ( but … )
  • 18. emotional whimsical beautiful functional
  • 21. many sources or categories independently scrollable content pieces equal
  • 24. Stacked image galleries Change image size, in a scalable way <ImageView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="300dp" android:layout_height="200dp" > </ImageView> 150 dp by 100 dp Smartphones, 2.3+ 10-inch tablets, 3.2+
  • 25. Stacked image galleries Override getView() public View getView( int position, View convertView, ViewGroup parent) { LayoutInflater inflater = getLayoutInflater(); ImageView i = (ImageView) inflater.inflate( R.layout.image, parent, false ); i.setImageResource(mImageIds[position]); i.setScaleType(ImageView.ScaleType.FIT_XY); i.setBackgroundResource(mGalleryItemBackground); return i; }
  • 26. Stacked image galleries Use BitmapFactory.Options BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = false; options.inDither = false; options.inScaled = false; options.inPreferredConfig = Bitmap.Config.ARGB_8888; options.inTargetDensity = screenDensity; // 160 dpi Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.sample_0, options);
  • 27. emotional whimsical beautiful functional
  • 28. hide and show fragments
  • 29. Hide and show Watch the orientation change
  • 30. Hide and show Stacking is better
  • 31. Hide and show But hiding and showing is even better
  • 33. Hide and show Slide one fragment out and another in FragmentTransaction ft = getFragmentManager().beginTransaction() ; ft.setCustomAnimations( R.anim.slide_in_left, R.anim.slide_out_right ); DetailsFragment newFragment = DetailsFragment.newInstance(); ft.replace( R.id.details_fragment_container, newFragment, "detailFragment"); // Start the animated transition. ft.commit();
  • 34. Hide and show Or, use show() and hide() public void onClick(View v) { FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.setCustomAnimations( android.R.animator.fade_in, android.R.animator.fade_out); if ( fragment.isHidden() ) { ft.show(fragment); button.setText("Hide"); } else { ft.hide(fragment); button.setText("Show") } ft.commit(); }
  • 35. ok. what was that animation part?
  • 36. Hide and show Create an XML animation <set> <objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" android:duration="500" android:valueFrom="-1280" android:valueTo="0" android:valueType="floatType" android:propertyName="x" /> </set>
  • 37. Hide and show Set the custom animation if (fragment.isHidden()) { ft.setCustomAnimations( R.anim.infromleft, R.anim.outtoleft); ft.show(fragment); button.setText("Hide"); }
  • 38. emotional whimsical beautiful functional
  • 39. so. how do we get whimsical?
  • 41. playfulness sets your app apart engagement of the heart
  • 43. What would it be like to shop in several languages?
  • 45. Flipping lists Target API 11 or higher <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="13" /> android.animation
  • 46. Flipping lists Use two ListView elements <LinearLayout … > <ListView android:id="@+id/list_en" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="match_parent" /> <ListView android:id="@+id/list_es" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="match_parent" android:visibility="gone" /> </LinearLayout>
  • 47. Flipping lists And an ObjectAnimator ObjectAnimator visToInvis = ObjectAnimator.ofFloat( visibleList, "rotationY", 0f, 90f); visToInvis.setDuration(500); visToInvis.setInterpolator(accelerator); final ObjectAnimator invisToVis = ObjectAnimator.ofFloat( invisibleList, "rotationY", -90f, 0f); invisToVis.setDuration(500); invisToVis.setInterpolator(decelerator);
  • 48. more info animation in honeycomb chet haase http://bit.ly/grk1rI apidemos, animation
  • 49. emotional whimsical beautiful functional
  • 50. won't you join us? @suzalex @motodev
  • 51. LEGAL LICENSE NOTICES Except where noted, sample source code written by Motorola Mobility Inc. and provided to you is licensed as described below. Copyright © 2010-2011, Motorola, Inc. All rights reserved except as otherwise explicitly indicated. • Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. • Neither the name of the Motorola, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. • THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. O Other source code displayed in this presentation may be offered under other licenses. Apache 2.0 Copyright © 2010, Android Open Source Project. All rights reserved unless otherwise explicitly indicated. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Creative Commons 3.0 Attribution License Portions of this presentation are reproduced from work created and shared by Google (http://code.google.com/policies.html) and used according to terms described in the Creative Commons 3.0 Attribution License (http://creativecommons.org/licenses/by/3.0/). MOTOROLA and the Stylized M Logo are trademarks or registered trademarks of Motorola Trademark Holdings, LLC. All other trademarks are the property of their respective owners. © 2011 Motorola Mobility, Inc. All rights reserved.

Editor's Notes

  • #3: introduce myself was a developer, then one day I had a usability invention, and my life changed. this year, the motodev team traveled around the world, teaching developers how to work with honeycomb. many developers asked me for ui patterns for tablets.
  • #4: … play video from the xoom using hdmi … this slide is here
  • #6: yikes !! you can&apos;t give me dogfood apps ! I am the President of the United States !!! aarrgghh !!!! wait !! more apps are coming soon
  • #7: OPTIONAL … DEMO YOUTUBE AFTER Now, if you want your app to have good design and appeal to users, and also take advantage of the beautiful platform that Android Honeycomb offers, you&apos;ll want to appeal to users on all 4 levels of the hierarchy of needs. And you want to start from the bottom and work up. Those levels are – functional, beautiful, whimsical, and emotional. Functional means that the app is useful and its interface works well. All technology innovations start at a functional level. This level is where user interface design often focuses. Beautiful is about aesthetics. It means the app appeals to the senses, especially the senses of vision, hearing, and touch. After you handle those two needs, you can work on Whimsical . Whimsical means that the app is playful, fun, and enjoyable. This makes users want to use it and want to come back. We&apos;ll look at some good examples of doing this in a few moments. And Emotional is the highest level. This is where an application satisfies some emotional needs in your users. A good example of this is an application that builds communities. The reason this is important is that … Competition based on price and functionality has been commoditized. To win, companies are differentiating based on “the aesthetic imperative,” or beauty, uniqueness and meaningfulness.
  • #9: There are two ways you can work. If you want to take full advantage of large screens and make your app tablet only .. The first three lines say that the app does not support the traditional screen size buckets – small, normal, and large – which are usually not tablets. Those lines are for Android 3.1 or older. The last line, with requiresSmallestWidthDp, says that your app requires a screen size with a minimum width of 600dp. 600 dp is generally a 7&amp;quot; or larger screen. Your minimum size might be different, depending on how well your design works on different screen sizes. You might require a minimum width of 720dp. BUT – You must compile your app against Android 3.2 or higher to use requiresSmallestWidthDp. Develop your app against the minimum API level When building your release candidate, change build target to Android 3.2 and add requiresSmallestWidthDp At runtime, older Android versions ignore it, so there&apos;s no risk of runtime failure. So you CAN work this way … but you might also want your app to run on both smartphones and tablets. This will become much easier with the upcoming Ice Cream Sandwich release.
  • #10: When Ice Cream Sandwich arrives, Android apps will be forward compatible. An app developed for Honeycomb will be compatible with a device running Ice Cream Sandwich, which could be a tablet, a phone, or maybe another type of device. If your app is designed to use all of a large screen to deliver content, optimizing it for handsets can be tricky. But it&apos;s worth the effort, because Ice Cream Sandwich brings the Honeycomb APIs to smartphones, and you&apos;ll substantially increase the user base for your app. Using a single APK also simplifies the process of updating and publishing to Android Market.
  • #11: The two best guidelines we can give you now are – Build your design around fragments that you can use in multi-pane layouts on smartphones and single-pane layouts on tablets Keep your action bar simple, so the system can adjust its layout based on screen size A good example of a simple action bar is Pulse News.
  • #12: OPTIONAL … DEMO YOUTUBE AFTER But most usability problems occur because we&apos;re trying to satisfy one or more levels of the hierarchy of user needs. That hierarchy, starting from the bottom up, is Functional, Beautiful, Whimsical, and Emotional. Functional means that the app is useful and usable. Users can navigate and use the user interface, The next level, Beautiful , is about aesthetics and appealing to the senses, especially the senses of vision, hearing, and touch. You should always make sure your app satisfies those two levels first. The third level, Whimsical , means the app is fun and engaging. We&apos;ll look at some specific patterns and techniques for adding Whimsical in a few moments. The fourth and highest level is Emotional . When you app works on this level, it satisfies some of your users&apos; emotional needs. One way to do this is by creating communities. An example of an app that works on at least 3 of these levels is the YouTube app for tablets.
  • #13: So the goal of UI patterns is to provide a repeatable solution to a recurring problem. We&apos;d like to show you a few UI patterns for Honeycomb and Android tablets today.
  • #14: Now, to introduce our first pattern. Tablets have 4-way rotation … so what does your app do when the device turns upside down? You can choose to have your app rotate in all 4 directions, and that&apos;s the most versatile approach. But sometimes, for some reason, you really want your app to be landscape only, or portrait only. An example of this is a digital magazine app that is designed to be read in portrait. CLICK
  • #15: So there&apos;s a pattern called up + down rotation. This sounds very simple and obvious for experienced developers, but we&apos;re finding that many developers aren&apos;t aware of it, so we just want to mention it. CLICK
  • #16: If your app wants to be landscape only …
  • #17: If your app wants to be portrait only, in theory, you can use screenOrientation = portrait. *** issue *** sensorPortrait doesn&apos;t compile file a bug for google
  • #18: Or, for 4-way rotation, use sensor, fullSensor, or the default - no value.
  • #19: So that pattern works on a functional level. Now let&apos;s look at a pattern that works on both Functional and Beautiful.
  • #21: This is an example of a smartphone app, a shopping app. It uses an image gallery that doesn&apos;t transfer well to tablets. It may be Functional, but not quite – because the images are very small and hard to tap. It&apos;s also not taking advantage of the large screen that tablets have to offer.
  • #22: so the pattern we want to show you is stacked image galleries, which is used in Pulse News, a very successful app for Android tablets. use when you want to display many content items that have equal importance and are similar to each other. the items are grouped into categories or sources -- you want to display multiple categories or sources at the same time, with each category independently scrollable. for example - news items articles blog posts recipes classes videos
  • #25: So here, we&apos;re setting the image size in a scalable way, by creating two ImageView sizes, in two different directories. The tablet size, in layout-sw720dp, is 300dp by 200dp. The smartphone size, in layout, is 150dp by 100dp.
  • #26: Now, when you do this, you want to use this form of the inflate() method. The first paramater is the layout file. the second parameter is the parent view, which getView() gives you you must always pass the parent if you pass null as the parent, the layout inflater does not know what type of layout parameters to create, and ignores all the android:layout attributes the third parameter should be false, because it tells the inflater not to add the inflated view to the parent right away. that&apos;s the right thing, when you&apos;re in an adapter&apos;s getView() method
  • #27: You also want to be careful of image quality. To get better quality when scaling images, especially when scaling images up for 10-inch tablets, use the BitmapFactory.Options class. This is what works well in my sample. I&apos;ve set options.inDither to false, and options.inScaled to false. I&apos;ve also set optionsinPreferredConfig to ARGB_8888, which means the bitmap stays at 32 bits. Then I use BitmapFactory to load it. DEMO APPS – Background PhotoBig
  • #34: To animate the transition between fragments, or to animate the process of showing or hiding a fragment you use the Fragment Manager to create a Fragment Transaction. Within each Fragment Transaction, you can specify in and out animations. The in animation is used to show a fragment, the out is used to hide one, and both are used for replace. This code shows how you would replace a fragment by sliding out one fragment and sliding the other one in it&apos;s place.
  • #35: To show and hide fragments, you want to use a FragmentManager to create a FragmentTransaction. A FragmentTransaction handles a set of fragment operations and then commits them. Now here, on this Fragment object, there&apos;s a very useful method on the Fragment class, called isHidden(), that returns true if the fragment has been hidden. There are also some very useful methods on the FragmentTransaction class, show() and hide(). With these three methods, it will be very easy for you to show and hide fragments.
  • #37: You also need to write some animations. For example, if you want a fragment to slide in and slide out, you would write slide_in and slide_out animations. If you want to define the animation in XML, use an objectAnimator tag. This animation slides an object (or a fragment) in from left to right – so here, we&apos;re sliding in from -1280, way off the screen to the left, to position 0.
  • #38: And then, remember to set your custom animations, using FragmentTransaction.setCustomAnimations.
  • #46: The new animation system in Honeycomb is not specific to Views, and it&apos;s not just a visual animation system. Instead, the new animation system animates values over time, and assigns those values to ANY target objects and properties. So you can animate a View or a Drawable, or any object that has values in a data structure. The Android platform is actually changing properties on target objects.
  • #47: So here we&apos;ve defined two ListViews, which are populated by two different arrays of strings, one in English and one in Spanish.
  • #48: For this animation, you use the new ObjectAnimator class. It&apos;s new in Honeycomb, since API level 11, part of the android.animation package. So here, pay attention to the ofFloat method. The first ofFloat method is setting animation on an object, named visibleList . It&apos;s also saying that the animation will take place on a new property that&apos;s added to the View class with this new animation system. That property is rotationY , and it controls rotation around a pivot point. So here, rotationY controls rotation around the Y axis. The visibleList is being rotated out from position 0 to position 90, and invisibleList is being rotated in from -90 to 0. So there are a lot of cool things you can do with the new animation package in Honeycomb. If you&apos;re interested in animation, you&apos;ll want to check out the post by Chet Haase on the Android Developer Blog, and the animation demos in the API Demos sample. So I&apos;ll leave you to play with that.
  • #50: So that&apos;s an example of one quick, simple animation you can add on Honeycomb, to bring a bit of fun and whimsical into your apps. Now I didn&apos;t talk much about emotional today, because emotional is more about the experience of your entire product or service. Remember, for a good example of an app that fulfills emotional needs, look at the YouTube app on tablets.