http://www.developer.com/ws/android/devices/Building-Killer-Android-Tablet-Apps-Design-and-Development-Tips-3909871-2.htm

Back to article

Building Killer Android Tablet Apps: Design and Development Tips


October 25, 2010

Device manufacturers are ramping up an exciting new line of Android devices: tablets. The success of the Apple iPad has proven that consumers are ready for these devices, which make consuming media content like video and audio a rich and enjoyable experience. But there's a catch: until now, Android developers have made certain assumptions about the target devices their apps run on -- assumptions like "the device is a phone," "the device has a small screen" and "the device includes the Google app experience." These assumptions will not always hold true for tablets and other types of Android-powered devices. In this article, we offer some tips and tricks for ramping up your skills to design and develop killer apps for the Android devices of the future.

Android Supports Tablets?

Yes, and no. You may be aware that Android has been ported to many kinds of devices, including phones, toasters, microwaves and laptops. However, just because Android runs on these devices doesn't mean the user experience is great or the device is officially recognized by the Android community.

So what about the Android tablets that are already in users' hands? Well, the Android operating system is open and free. Manufacturers can put Android on whatever devices they want to, and many have. Archos has been making Android tablets for quite some time. However, these devices run a modified version of the Android OS that has been tuned for the tablet device. Until now, tablets have been something of a gray market, but that's about to change.

Until recently, Google and the Open Handset Alliance have not approved any Android tablets for use with Google proprietary applications such as Gmail, Maps, and most importantly, the Android Market. This will change with the next wave of Android tablets; Google has acknowledged that tablets and other devices will be recognized and incorporated into the Android platform in future versions of the Android SDK and the Android Market. Now, there's a wave of new Android-powered devices slated to hit the shelves late this year and early next year from the likes of Acer, Dell, Samsung, Toshiba, Viewsonic, Archos and more.

Developers are eager to write apps for these exciting new devices and ensure that their existing apps will run smoothly. The question is: how? Google has made a statement to the effect that the current version of Android (2.2, or Froyo) is not designed for tablets. The next version of Android (Gingerbread) is likely to address some of these issues, but developers need not wait to start preparing for the onslaught of Android tablets.

Application Design for Android Tablets

Lazy development assumptions may have worked when there was really only one type of device (a phone), but these bad habits may come back and bite you when your app is deployed on a device like a tablet. Reconsider previous design decisions now and update your applications to make them compliant with the latest configuration options available on the Android platform to help ensure that your application is ready for the future.

The good news is that developing for new Android devices isn't going to be that different from developing for existing ones. Most existing apps will run well enough, provided they've been designed prudently, by which we mean:

  • The app properly identifies its application hardware and software requirements using the Android Manifest file tags such as supports-screen, uses-configuration, uses-feature and uses-permission.
  • The app code checks for hardware, services and optional APIs before attempting to use them.
  • The app designers minimized the assumptions about which exact devices or hardware the application would run on.

Just as not all Android devices support Bluetooth or WiFi, there are -- and will continue to be -- new optional APIs for working with specific devices, including tablets. Some of these APIs may be baked into future versions of the Android SDK (like Gingerbread) while others may be third-party add-ons available from manufacturers. These may be similar to such add-ons available for current handsets; the SenseUI is available for some but not all HTC devices, or MotoBlur on some but not all Motorola devices.

User Interface Design for Tablets

When it comes to designing user interfaces for tablets, it's best to stick with flexible layout designs that will scale well to various screen sizes, resolutions and orientations. This way, users will find the experience familiar, regardless of what type of device they use. Here are some tips for designing user interfaces for tablet devices:

  • Keep screens streamlined and uncluttered and ensure touch controls such as buttons are of adequate size.
  • Use flexible layout controls such as LinearLayout and RelativeLayout as opposed to pixel-perfect ones such as AbsoluteLayout.
  • Use flexible dimension values like dp and sp instead of px or pt.
  • Use alternative resources such as graphic and dimension resources to provide specialized resources for different screen sizes, aspect ratios, pixel densities and touchscreen types.
  • Use alternative resources such as layout and graphic resources to provide specialized resources for landscape and portrait modes.

Testing Apps for Android Tablet Compatibility

Although few tablets have been released yet, nothing is stopping you from beginning to test your existing apps and ironing out the obvious issues. Here are some tips to keep in mind when testing for tablet compatibility:

  • Testing on the actual devices (as opposed to the emulator) will be critical to ensuring your application behaves as expected. Some devices, such as Samsung's Galaxy Tab, have reported their hardware characteristics differently than expected. For example, despite having a medium-density screen, Samsung chose to have its new tablet report as a high-density screen because it looks better (see Figure 1).
  • Some tablets may not include the Google "experience," so make sure you also test with Android Virtual Devices (AVDs) that do not include the Google add-ons.
  • Tablets, among other devices, are beginning to take a landscape-first approach to the screen. Make sure your app displays properly in both orientations and handles orientation changes correctly (see this Android Developer Blog post for details).

Finally, one of the best things you can do right now to ensure your app is tablet compliant is load your app into the emulator with a tablet-style AVD configuration and see how it behaves. For example, use the following steps to create an AVD configuration that mimics how your application would display on a tablet much like the upcoming Galaxy Tab:

  1. Launch the Android SDK and AVD Manager.
  2. Press the New… button.
  3. Enter a name for the tablet (e.g. "Tablet Emu") and choose an appropriate SDK version, such as Android 2.2.
  4. Create an SD card (We use between 32MB and 512MB).
  5. For the Skin section, choose Resolution and enter "1024" and "600" into the appropriate boxes. If you enter 1024 then 600, the device will start in landscape mode. If you enter 600 then 1024, it will start in portrait mode.
  6. For the Abstracted LCD Density, any value will work (although the values 120, 160 and 240 are suggested). To mimic the actual screen density of the Galaxy Tab, enter 170. The device will be treated as a medium-density display. To mimic the reported screen density, enter 240. The device will be treated as having a high-density display.
  7. Choose Create AVD.
  8. When it's created, launch it with the Start… button.
  9. As the display size is rather large, you may wish to scale it down using the launch parameters.

Figure 1 below illustrates how an application might appear on a custom AVD to mimic a tablet. It also demonstrates the difference between a medium-density display with the same pixel resolution as a high-density display. Because the density is different, the buttons on each screen actually draw at the same size. The medium-density display, however, shows a lot of wasted screen space. This not only demonstrates one example of why Android isn't quite ready for larger screen tablets, but also shows why a manufacturer might want to report a different value.

 

Building Killer Android Tablet Apps
Figure 1. Android App Mimicking a Tablet on a Custom AVD

 

Stay Tuned

If the rumors are true, the next major release of the Android SDK (Gingerbread) will begin to address some of the device differences in some official manner. Expect to see changes such as additional APIs for optional hardware, updates to the Android Manifest configuration options available for targeting specific device characteristics, and perhaps new controls and screen layout options. We are also likely to see changes to the Android Market to reflect the plethora of devices about to reach consumers' hands. For example, sources at Google have implied that certain application permissions (as defined in the Android Manifest file using the tag) may be used by the Android Market to filter apps for devices in the future.

In that future, Android-powered devices will likely come in many forms: phones, PDAs, music players, tablets and toasters. For now, one of the best things you can do as a developer is start to think along these lines. Be mindful of the assumptions you make when developing your apps, and consider how they will restrict or allow your apps to run on different types of devices. Review your existing apps and update them with more flexible user interfaces and prudent assertions on device features and characteristics.

With the introduction of Android tablets, developers now have a whole new range of devices to target with their applications. Android tablets are likely to boast larger and higher-resolution touchscreens, video output options, front-facing cameras and other optional hardware features -- at very reasonable prices. These features enable developers to write new kinds of applications and enter new markets. Developing Android apps for tablets requires some forethought, but many of the design principles for writing great Android apps for tablets really apply to all device targets.

About the Authors

Lauren Darcey and Shane Conder have coauthored two books on Android development: an in-depth programming book entitled Android Wireless Application Development (ISBN-13: 978-0-321-62709-4) and Sams Teach Yourself Android Application Development in 24 Hours (ISBN-13: 978-0-321-67335-0). When not writing, they spend their time developing mobile software at their company and providing consulting services. They can be reached at androidwirelessdev+dc@gmail.com and via their blog at androidbook.blogspot.com. Follow them on Twitter @androidwireless.

Sitemap | Contact Us