Make an Android App in Ten Minutes

Make sure you follow the installation guide before proceeding.

  1. First we need to create a project. In TextMate > Bundles > Android, click on New Project and select a Workspace. A workspace is basically the folder you want to generate/save your project in. Now enter "HelloWorld" for "Project Name" and "HelloWorldActivity" for "Activity". Select "android-5" as the Build Target to target Android 2.0 phones and press Create to generate the files. New Project Settings
  2. TextMate will open the HelloWorld folder and view the file HelloWorld/src/com/example/HelloActivity.java. That's your Activity class, an Activity is a class that can run and do work. Change the code to the following:
    package com.example; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class HelloActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText("Cow says Moo"); setContentView(tv); } }
  3. Now let's create a Android Virtual Device to run our app. In TextMate > Bundles > Android, click on New Device and fill in "AwesomeAndy" for "Device Name" and select "android-5" for the "Build Target" to create a Android 2.0 virtual device. Press Create. New AVD Settings
  4. In TextMate > Bundles > Android, click on Build App and select "debug" as the build type. The project will compile as a .apk file in HelloWorld/bin, be ready for installation.
  5. In TextMate > Bundles > Android, click on Launch Emulator. Click on "AwesomeAndy" to launch the emulator, a dialog will come up asking whether you want to wipe the data (clear the data partition and any old data). Click "yes" and let the emulator launch. It will take a couple minutes for the emulator to boot up. If you get messages in the emulator about non-responding devices, just press "wait". AVD list
  6. In TextMate > Bundles > Android, click on Install App, two dialogs will come up. The first one will ask you whick .apk file to install, choose the one you just created "HelloWorld-debug.apk". The second dialog will ask you which device to install on. Since you've only have one installed, just leave it at the first option and press OK.
  7. Time to view our app! Navigate to the apps on the phone, and click on HelloActivity. Cow App
Top