|
Cyril Sermon (@admin) |
All you need to start writing your own Android applications is a copy of the Android SDK and the Java development kit. Unless you’re a masochist, you’ll probably want a Java IDE — Eclipse is particularly well supported — to make development a little easier.
Versions of the SDK, Java, and Eclipse are available for Windows, Mac OS, and Linux, so you can explore Android from the comfort of whatever OS you favor. The SDK includes an emulator for all three OS environments, and because Android applications are run on a virtual machine, there’s no advantage to developing from any particular operating system.
Android code is written using Java syntax, and the core Android libraries include most of the features from the core Java APIs. Before they can be run, though, your projects are first translated into Dalvik byte code. As a result, you get the benefits of using Java, while your applications have the advantage of running on a virtual machine optimized for Android devices.
The SDK download includes all the Android libraries, full documentation, and excellent sample applications. It also includes tools to help you write and debug your applications, like the Android Emulator to run your projects and the Dalvik Debug Monitoring Service (DDMS) to help debug them.
By the end of this, you’ll have downloaded the Android SDK, set up your development environment, completed two new applications, and run and debugged them using the emulator and DDMS.
If you’ve developed for mobile devices before, you already know that their small-form factor, lim-ited power, and restricted memory create some unique design challenges. Even if you’re new to the game, it’s obvious that some of the things you can take for granted on the desktop or the Web aren’t going to work on a mobile.
As well as the hardware limitations, the user environment brings its own challenges. Mobile devices are used on the move and are often a distraction rather than the focus of attention, so your applications need to be fast, responsive, and easy to use.
This post examines some of the best practices for writing mobile applications to help overcome the inherent hardware and environmental challenges. Rather than try to tackle the whole topic, we’ll focus on using the Android SDK in a way that’s consistent with good mobile design principles.
The Android SDK includes all the tools and APIs you need to write compelling and powerful mobile applications. The biggest challenge with Android, as with any new development toolkit, is learning the features and limitations of its APIs.
If you have experience in Java development, you’ll find that the techniques, syntax, and grammar you’ve been using will translate directly into Android, although some of the specific optimization tech-niques may seem counterintuitive.
If you don’t have experience with Java but have used other object-oriented languages (such as C#), you should find the transition straightforward. The power of Android comes from its APIs, not from Java, so being unfamiliar with all the Java specific classes won’t be a big disadvantage.
Because Android applications run within the Dalvik virtual machine, you can write them on any plat-form that supports the developer tools. This currently includes the following:
❑Microsoft Windows (XP or Vista)
❑ Mac OS X 10.4.8 or later (Intel chips only) ❑ Linux
To get started, you’ll need to download and install the following:
❑The Android SDK
❑Java Development Kit (JDK) 5 or 6
You can download the latest JDK from Sun at
http://java.sun.com/javase/downloads/index.jsp
If you already have a JDK installed, make sure that it meets the version requirements listed above, and note that the Java runtime environment (JRE) is not sufficient.