Getting Started with AndroidDo you have an idea for the next revolutionary or “magical” mobile application that will change the world? Do you want this application to run on the premier open mobile operating system, Google® Android? Are you not sure where to start or what tools you need? Do you want your application compatible with all the various Android handsets on the market?
If you answered yes to those questions, you are in the right place! This blog post will give you some basic information and point you towards sources to help you in designing your application.
Android is all about openness. So it should be no surprise that the tools needed to create Android applications are open source and available for the 3 main desktop operating systems, allowing you the freedom to develop your application in the environment that works best for you. Google has come up with a great guide to get the tools you need to get started with Android. It has instructions and links to download and install all the tools you’ll need to develop your new awesome Android application.
Alternatively, Motorola has developed a package called MOTODEV Studio for Android that packages everything you need to get started developing with Android in one package. Included with this package is the MOTODEV Studio for Android plug-in. This plug-in gives you tools that will allow you to sign and export you application so that it is ready for the Android market. You also get tools that allow you to take screen shots of your application in the emulator as well as manage files and database in your emulators or connected devices and much more. If you already have Eclipse installed on your machine and don’t want to download the entire MOTODEV Studio for Android package, you can download and install just the plug-in to your existing Eclipse environment.
Once you have the tools installed and configured you need to have a good grip on some Android fundamentals. Google has a great guide to get you started and will give you a good overview of Android application development.
Application Design Tips
Fragmentation - if you have read about Android development before you’re sure to have run across what people describe as the fragmentation of the Android platform. In about 18 months Android has gone from version 1.1 to 2.1 and is now installed on over 60 different device models. At the time that this blog post was written over half of the Android devices where running a version prior to 2.0. Those 60 devices also have varying screen sizes, screen densities and hardware capabilities. All these factors need to be kept in mind when designing your application.
So how do you design your application to use the newest features of Android while keeping it compatible with older versions of the platform? Reflection is a great solution to this problem. A specific example of this is the Contacts model. The Contacts model for pre-2.0 versions of Android is very different from 2.0+ version. You can still call the older API’s from the new versions of the OS but will not be able to take advantage of the new features that are available to users of the newer OS. In this solution, you would create two wrapper classes one of which would implement the older version of the API while the other class would implement the new version of the API. Once you determine which version of the API your application is currently running you can use reflection to initiate the compatible Contacts wrapper class. For more details about Android and Reflection, see this article.
Views - in an Android application, the user interface is built using View and ViewGroup objects. There are many types of views and view groups, each of which is a descendant of the View class. See this guide from Google for more information about Android Views and UI.
One important thing about the Views for your UI is that they need to be as efficient as possible. There is a real cost to initializing and inflating your layouts and if they are inefficient that cost will be high. It becomes especially bad when you use an inefficient layout in a ListView that contains multiple instances of your view. Check out this series of blog posts by Romain Guy, an engineer on the Google Android project. In this blog series Romain explains how to create efficient views and how to you use the SDK Tools to get some insight into what your views look like to Android:
Motorola has some best practices (with links) for user interfaces with Android that is also very useful:
A very helpful tool for creating the XML for your views is DroidDraw.org. This website allows you to drag and drop common layouts and widgets onto a screen and then generate the XML needed to create that view. While it’s not perfect, it does allow you to very quickly get a base outline of what you want your view to be and then allow you to customize it for you needs. And it’s much better than the one default layout editor that comes with Eclipse.
In a future Android blog post we will look specifically at implementing OAuth in your Android application.
Kelly Klein is a Developer for Fellowship Technologies. He has been with Fellowship Technologies since March 2009. As a side project with Funkypants Software he developed the Fellowship One for Android application. He is passionate about serving the Church through technology.
Posted In: Tips,
- Include Requirements & Contribution Sub Types
June 9, 2014
- User Case Story from Hope Community Church
October 28, 2013
- Group Search Categories and More
October 21, 2013
- Account Creation
August 7, 2013
- Single Sign On Functionality Exposed
June 25, 2013
- API Communication Value Changes
November 2, 2012
- API Enhancement: Create and Edit Groups!
August 13, 2012
- API Enhancement: Requirements Exposed
June 25, 2012
May 23, 2012
- Resource Versioning
April 24, 2012
- Enter Visitor Data via Your Church Website
March 16, 2012
- Fellowship One & Planning Center Online
March 1, 2012
- API Libraries and Sample Code
February 7, 2012
- Building a custom login for your church website using the API
November 29, 2011
- Roll Foward!
August 9, 2011
- The Agile Triangle
July 27, 2011
- Conversation Paralysis
July 7, 2011
- Picture this, image updates & creates through the REST API
May 10, 2011
- A REST API double shot : Groups and Events realms
May 9, 2011
- Increasing Software Delivery by 500%
May 3, 2011