Getting started as an Android developer

Android is the most accessible and least expensive mobile platform for developers to get started with. Although you may eventually want to publish your apps on the Google Play Store, which requires a minimal fee, getting and using the developer tools is free.

Here’s how to get started:
1. Download the Android Studio.
2. Turn on the developer options on your device.
3. Head over to the Getting Started site to begin.

Downloading the Android Studio IDE

Google has partnered with JetBrains to create an integrated development environment (IDE) that’s customized for Android development. Of course you can continue to use whatever environment you like as long as you have the SDK, but this IDE makes getting started simple.

Download the Android Studio.

Enable Developer Options

Although the Android Studio has great emulators, you should also test your apps on actual devices. Enable those devices for debugging and developer support by tapping 7 times on your device’s “Build number” label. Yes, you heard right. Use these instructions to find this on your device.

The Getting Started Guide

The best information for getting started is the Android site itself. It has great tips for new users and veterans. I recommend starting on the developer’s training site.

Enumerating Android Calendars

AndroidAndroid APIs allow you to query information about calendars in your system. Your application can perform typical read, write, update, and delete (CRUD) operations on calendars using a combination of several classes.

To retrieve calendar data, you’ll use the following classes:

  • Context
  • ContentResolver
  • Cursor

Android security requires that you announce your application’s intentions for calendar access. You indicate this in the application’s manifest file. The following manifest entry tells the Android platform that your application will read calendar information:

<uses-permission android:name="android.permission.READ_CALENDAR"/>

Make sure that the <uses-permission> is immediately outside the <application> tag. If you do not put this permission indicator in your manifest file, your application will throw security exceptions. More importantly, it won’t be able to access calendar information.

Why do you need three classes (Context, ContentResolver, and Cursor) to retrieve calendar information? First, a cursor is used to iterate through calendar information. Second, the Cursor is provided by a ContentResolver. Finally, you need a Context to retrieve a content resolver.

Within an Activity class, which represents a user-interface view, you can get a content resolver easily with the getContentResolver method. An Activity is a subclass of Context. That’s simple enough. However, if you want to separate concerns, you may want to create a calendar service to isolate calendar details from the rest of your application. As a separate, non-Activity, class, your CalendarService (implementation left to the reader) may not have access to a context. So you may need to provide a resolver or context from your Activity when instantiating a CalendarService instance. 

Here’s how you retrieve the content resolver:

import android.content.ContentResolver;
// if you are calling from within an Activity
ContentResolver resolver = getContentResolver(); // if you are calling from elsewhere with access to a Context ContentResolver resolver = context.getContentResolver();

Once you have the resolver, you can then query it for the exact data items needed. Calendars have a lot of information including name, time zone, and colors. Tell the resolver exactly what you want by declaring a projection. A projection is simply a String array that indicates the fields that you want to extract from a calendar row in Android’s databases.

The following code shows how to perform the query:

import android.provider.CalendarContract;
String[] projection = {CalendarContract.Calendars._ID,
String selection = String.format("%s = 1", CalendarContract.Calendars.VISIBLE);
Cursor c = contentResolver.query(CalendarContract.Calendars.CONTENT_URI,
    null, null);
while(c.moveToNext()) {
    // the cursor, c, contains all the projection data items
    // access the cursor’s contents by array index as declared in
    // your projection 
    long id = cursor.getLong(0);
String name = cursor.getString(1)); ... } c.close();

This particular example simply iterates over the calendar meta-data, not actual events. You’ll need an additional query for that.

Using the HAXM Accelerator for Android

Developing Android applications on Mac OS X is easy, especially if you are using Google’s new Android Studio or JetBrain’s IntelliJ. Also when you install Google’s SDK, you’ll get plenty of tools for creating virtual devices to test on. I created a Nexus 7 virtual device, and although it ran slowly, it did run smoothly. I soon got used to the workflow that involved running and testing my application on a different device (real and virtual).

After a few cycles of code, deploy to device, and test, I realized I was spending too much time waiting for the virtual device to load. I had randomly opted to run my AVD using an ARM system image, and other developers claimed that running on the Intel Atom CPU image would provide better performance for the time-consuming workflow. I decided that I’d give the Intel CPU image a try.

Using the Intel x86 image and reaping the benefits of a faster emulator requires that you install 2 additional items available in the Android SDK:

  1. Intel x86 Atom System Image
  2. Intel x86 Emulator Accelerator

You install the x86 CPU image from within the Android SDK Manager. The SDK Manager lists the different API versions, and you can see options to install system images. Install the x86 image by clicking the x86 option and then clicking on the “Install package” button.


From within the SDK Manager, you can also install the x86 accelerator. Look for the “Extras” section that includes the option to install the Intel x86 Emulator Accelerator (HAXM). The option looks like this:


After installing these options, you then select the Intel Atom x86 cpu image from within the AVD manager:


Running the AVD using the new image may have provided some speed improvement, but I really didn’t notice much. I was a bit disappointed. Then I discovered that I was supposed to also install HAXM. Wait, but didn’t I do that earlier in step #2? I thought I had, but actually I had only downloaded the HAXM installer. I caught on to this when I noticed the AVD startup dialog:

emulator: Failed to open the HAX device!
HAX is not working and emulator runs in emulation mode

Why did this warning message show up? I had used the SKD manager to install the needed pieces. By digging around in my Android SDK and “Extras” folders, I found a HAXM installer. I finally realized that although I had downloaded the HAXM installer, I had not actually installed HAXM itself. This isn’t perfectly clear when you select and install the HAXM option.


So, after you download the HAXM installer, look for it in your SDK folder. Install it. Run your emulator of an x86 processor, and….wow! An amazing improvement, and very noticeable. I was pleasantly surprised.

If you’re developing for Android, you’ll appreciate this information. It’s amazing how much it improves emulator performance. You’ll definitely see a difference in speed. You’ll be glad you installed both the x86 image and the HAXM accelerator. 

But remember…if you really want to get the benefits of the accelerator, you have to actually install it after you download it.


Tool Options for Android Development


When developing applications for the Android platform, you have several choices of integrated development environment (IDE). The environments are free and easy to download on the web.

The best known IDE is the combination of Eclipse and the Android Development Tools (ADT) plugin. This option has been around for the longest. As the most mature option, this development environment has the best community support as well. Additionally, you have two options for installing this IDE. The first option is to download and use the Eclipse + ADT pre-configured development bundle. The second option is to download the Eclipse and ADT plugin separately. Either option works well, and you can find instructions for both on the Android developer site:

Netbeans also has Android support. The support is available as a set of NetBean plugins from a site called NBAndroid. NBAndroid provides a free basic plugin and a paid set of “extensions.” The extension include gradle support and visual layout editing for 15 euros.

Finally, Google andJetBrains have teamed up to create a new development option called Android Studio. The well-known IntelliJ editor forms the basic platform, and the companies have have tightly integrated the Android SDK tools. Android Studio is not final, but you can download a beta version from Google here: Android Studio appears to be a tool branded under Google. However, you can get the same functionality from IntelliJ in either the IntelliJ IDEA Ultimate or IntelliJ IDEA Community Edition:  

So, there you have it: 3 options for Android development that are available for free.

Learning Android

I’ve neglected this space for a long time. The truth is that life gets in the way. However, I’ve picked up a new hobby — Android software development.

I’m in the initial stages now — setting up an environment, installing tools, and learning the platform. I hope to use my blog to communicate the information I learn about Android.

What about internationalization? Hmmm…I’m still interested in that. I suppose I will always be interested in internationalization. However, this isn’t currently my primary activity at this time; I’m not currently employed using this skill set. In fact, I’m doing something very different in my full-time work. Unfortunately as a result, I don’t write much about internationalization. 

As I learn Android, I will also share my knowledge of the i18n api and features. That seems reasonable since i18n is still one of my core interests. But you may find that the main topics won’t be pure i18n in the near future.

I have a great new Android device, the Nexus 7 (2013 version). I’m eager to get started with it.

To help in that effort, I’m going through an online coursera course called Programming Mobile Applications for Android handheld Systems. You might want to take a look at it too if your starting from scratch.

See you around and I hope you enjoy upcoming blogs.


Installing the Android SDK: My first steps

AndroidToday marks the first day of my official, end-of-year, get-caught-up on Android learning tour. And the first step is to install the SDK. Since I want to use Eclipse, I’ll need to install whatever Eclipse plugins/addons are available too. Let’s get started.


Installing the SDK

The Android SDK is on the Google Android Developer site. The SDK is a little difficult to understand. WIth enough reading over and over, I finally understand that the SDK has at least two parts:

  1. A general SDK that is platform independent
  2. A set of platform-specific tools.

If you don’t have the SDK at all, the best way to get both of these SDK pieces is to download and install the “Starter” SDK. After downloading it, unzip or install it into any convenient directory. Just make sure you have read/write access to this install directory. I installed these initial SDK files into ~/bin/android-sdk-macosx. Once you’ve done this, you will have both parts of the SDK, the general SDK and the platform-specific tools.

Updating the SDK

Apparently you can update the platform-specific tools without affecting other parts of the SDK. I have not done this yet because I am installing for the first time. When I do update, I’ll let you know the results.

Installing the Eclipse Plugin

This is probably the easiest part of the installation. Open your Eclipse IDE and open your menus selection Help->Install New Software. You can then add the Google Eclipse Plugin repository as shown below. Type in for the software repository address.

Screen Shot 2011 12 22 at 11 45 27 PM

You’ll see a list of software tools including the Android SDK plugin. Follow the rest of the onscreen instructions to install. Soon you’ll have everything you need to begin developing on the Android platform:

  1. The JDK
  2. Eclipse
  3. The Android SDK
  4. The Eclipse plugin for Android development (ADT)

I think there may be one more step…creating a target Android device for the emulator, but that may have to wait until the next blog.


Making Millions from Android App Store?

Finally, after a couple years wait, my cell phone plan contract ended, and I was able to affordably switch both carriers and phones. I promptly acquired the following new hardware after switching my cell service provider from ATT to Verizon (no particular reason other than ATT happened to be more intolerable at the time):

  • Droid Bionic cell phone
  • Samsung Galaxy Tab 10.1

Now that I have the hardware, I just have to download the Android SDK, write a new application, and become a millionaire by next weekend. Can’t wait!

Oh, but wait, that link about becoming a millionaire is for the iOS app store. Crud. Sigh….

It’s interesting to do a Google search for app store millionaire. It seems that many people have made both small and large fortunes from the Apple App Store. I’ve heard that luck is a big factor in hitting it BIG too. And of course, some of the big hits are just really stupid too.

It’s also interesting to note what my Google search didn’t immediately find. So far I haven’t found examples of Android market millionaires. Hmm… why is that?

Now that I have this hardware, my next step is to download the Android SDK and pump out a cool, viral app that makes me millions of dollars too. But have I picked the wrong platform? It’s obvious that the Android market doesn’t yet have the same number of customers as the Apple App Store. Will that change? What will it take?