i just realized it totally looks like he’s winking
So, this warning was plaguing me for a while:
ActivityManager: Warning: Activity not started, its current task has been brought to the front
"What is this crap?" I thought. "Why won’t the emulator start?!"
Then I looked down at my G1, which I had plugged in to my computer via USB to charge, and realized that my app was already running on my phone. I have no idea how this happened. Eclipse just found my phone plugged in and handed it the app, which it happily ran. Too effing cool!
"Hello world" achieved! I’m calling it a night.
Ugh, I guess I will assent to working with XML to the extent that it is necessary. Why would you use XML for an intra-IDE data format?! For God’s sake, it’s an IDE! The data format can be whatever you want! Just make the interface not suck, and—oh. Well, there’s my answer.
The raw basics for layout actually aren’t bad:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical"
> <EditText android:id="@+id/EditText01" android:layout_height="wrap_content" android:layout_width="fill_parent" android:inputType="numberSigned|numberDecimal"></EditText> <RadioGroup android:id="@+id/RadioGroup01" android:layout_width="wrap_content" android:layout_height="wrap_content"> <RadioButton android:id="@+id/RadioButton01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/celsius" android:checked="true"></RadioButton> <RadioButton android:id="@+id/RadioButton02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/fahrenheit"></RadioButton> </RadioGroup> <Button android:id="@+id/Button01" android:layout_height="wrap_content" android:onClick="@string/buttonHandler" android:layout_width="wrap_content" android:text="@string/calc"></Button> </LinearLayout>
I’m sure it gets hairier once you start building really complex and functional interfaces, but this doesn’t have any of the bloat that usually makes me terrified of XML. Also, I like the way it separates constants like strings and colors from the actual layout by letting you reference an XML file (as in android:text=”@string/someconstant”). I wonder how much of this is Eclipse, how much of it is Eclipse Helios, and how much of it is the Android SDK.
My Development Platform: Windows XP SP3
My Testing Device: G1 with CyanogenMod-184.108.40.206 (running Android 1.6)
I’ve never done Java development, nor any development with any IDEs, so this was kind of a hassle. I predict that I’m going to hate working without a command line.
- Download the Android SDK from the official Android site.
- Extract it.
- Run SDK Setup.exe.
- It complained about SSL errors, so I cancelled out of everything, went to “Settings” and set “Force HTTPS to be downloaded through HTTP.”
- In retrospect, I only needed to download API version 4, which is specifically for Android 1.6. But, I downloaded them all, and it took forever.
- Download “Eclipse IDE for Java Developers" (99 MB) from the Eclipse site. Turns out this is a special flavor of Eclipse called "Helios."
- Download “Java Platform (JDK)" from the Java site.
- Install them both.
- Open Eclipse, go to Help -> Install New Software.
- Select “Android” in the “Work with:” drop down menu. If “Android” isn’t there, add it with this URL: https://dl-ssl.google.com/android/eclipse/
- Install Developer tools and restart Eclipse.
- Go to Window -> Android Device and SDK manager, and create a new virtual device for testing.
- Go to New -> Other… -> Android -> Project and select your desired API version.
- I tried adding some values to res/values/strings.xml, but I was getting NullPointerExceptions. Some Googling turned up this thread, where the Helios developers apologized for the bug and someone suggests a workaround, which is going to Window -> Preferences -> XML -> XML Files -> Editor and unchecking “Use inferred grammar…”