Latest Publications

Google Android update: videos, development group, blogs

android-emulator.jpg

Videos on Google Android development can be found here;
http://www.youtube.com/user/androiddevelopers

There’s also a Google Group community setup for developers; http://groups.google.com/group/android-developers

As far as “blog reactions” there has been a lot written on the release of this SDK;
Happy Birthday to Android and devphone.com
JavaLobby: Android is out, first looks
Slashdot: Google’s Android Cellphone SDK Released
Comic: Android SDK reactions
Android SDK, Demo Video and Contest

Seems like overall reaction to the SDK is mainly positive. But it’s interesting to see in the Google Group there’s a lot of “why can’t I develop in X technology with Android, type of threads. Obviously, not everybody is happy with the choice of Java as the development language for this platform. Luckily for some of these people, it should be possible to code for an Android enabled phone with one of the many JVM compatible languages out there.

Update (Packages included in Android)

Packages included in the Android SDK.
http://code.google.com/android/reference/packages.html

One interesting thing to see is the Java SE APIs that are included and the ones that are not.

You can see the main language APIs for java.lang, java.lang.reflect, etc. Also included are the main util packages and network packages; java.util, java.io, java.nio.*. The Java 5 concurrency packages are there too, in addition to the Java 5 annotation package too.

What’s not included is anything for the SE UI; java.awt.*, javax.swing.*. There’s also no CORBA or RMI packages of course.

I’m glad to see a lot of the standard SE APIs, at one point I thought Google was not going to include these at all, it’s great to see they are there. It’s unfortunate there are no SE graphics APIs, this means no JavaFX for Android in my view. I guess you could still do some JFX apps but you’d have to map the graphics to the Android rendering API. However, given JFX relies on Java SE this causes a problem.

Also listed a junit packages … are these really included in the runtime? Not sure if that makes sense.

Listed are some Apache Commons packages, like codec (very useful) and the apache http client. Note that Java’s HttpURLConnection package is still there, so there are actually 2 HTTP client implementations in Android.

Android SDK released!

Mr. Roboto

Google has released the Android SDK on Google Code. The SDK is Java based and runs on Windows XP/Vista, Mac OS X 10.4.8+ and Linux. It requires a JDK 5 or 6 and Ant. Google provides an Eclipse plugin, but there are also instructions for using the SDK without Eclipse or with other IDEs (Jonathan Schwartz has promised a Netbeans environment for Android). The following video provides a quick intro to the Android architecture. Android runs on a Linux Kernel and applications are written in Java. For writing your own apps, the main 4 components you can use are;

  • Activity: UI component, a screen.
  • IntentReciever: Register code until it is triggered by an external event. Ex: Wake up code when phone rings.
  • Service: A task that runs on the background (no UI). Ex: Music stars in an activity, user does something else the service running the music will be in a service.
  • Content Provider: Share data with other processes and applications.

Other highlights include: WebKit used for web browser, SQLite for data storage, Java VM is called “Dalvik”. More details at the “What is Android” page.

For graphics, there are no signs of Graphics/Graphics2D or any AWT or Swing code to be found. Android provides it’s own component model, windowing and graphics libraries. The following code shows how to add a button with an anonymous listener;

http://code.google.com/android/reference/android/widget/Button.html

 public class MyActivity extends Activity {
     protected void onCreate(Bundle icicle) {
         super.onCreate(icicle);

         setContentView(R.layout.content_layout_id);

         final Button button = (Button) findViewById(R.id.button_id);
         button.setOnClickListener(new Button.OnClickListener() {
             public void onClick(View v) {
                 // Perform action on click
             }
         });
     }
 }

Very interesting stuff, of course one wonders what this means for JavaME. Android is an effort by the Open Handset Alliance, composed of over 30 companies. Missing in this group of course is Sun, also missing is more details like will there be any JavaME interoperability with Android applications, or what this means for the mobile version of JavaFX.

I also couldn’t find details on to what extent of the Java SE API is included in Android (have to try that Eclipse plugin). I’m guessing it won’t include the javax.swing and java.awt packages, but a more detailed list would be nice. It’s good to see that at least it will support Java 1.5 language features. I’m also glad is Google is providing more information on this platform than what you usually see with Apple.

Now all I need to do is find some time to create a couple of apps and see if I have a shot at winning some money!

New Java logo, Ruby style! (a few thoughts on programming language marketing)

Java on Ruby!

No, I’m not proposing my brand new Java logo replace the latest one from Sun. As a matter of fact it’s hardly a good logo, and seems more like a book cover, but for some reason a very similar logo (the one mine is based on) was selected as the official one for Ruby.

Ruby logo

People are being a bit harsh on the thread from that last link, but yeah the logo they selected is not that great. Maybe it would make an OK book cover, but you would expect something a bit simpler and more visually appealing. Also was it really necessary to put “programming language” as part of the logo? That just looks bizarre.

(more…)

Beware of rotten apples

Rotten development environment

I like Apple, it’s a highly innovative company with great products. I passion for programming was developed as a kid when I had an Apple //c. I own a couple of iPods and wouldn’t mind having one of those cool MacBooks. A few years ago, and at this year’s JavaOne, I noticed lots of developers with cool looking Apple computers. They definitely look a lot more interesting than the standard corporate Dell stuff. But one thing got my attention at this last JavaOne, I noticed a lot of Sun engineers with Apple laptops, and doing demos on those machines.

Nothing wrong with that, I didn’t expect them to be hauling some of those Sparc/Solaris laptops. However, Java 6 had already been out and there was a lot of talk of future features (Java 7 and beyond) related to the language and I found it odd that it seemed like a lot of Sun engineers would do their work on an Apple machine with versions of Java that are not current. I expect Microsoft engineers to have no problem running the latest and greatest versions of the .net framework, but tosee some of the Java desktop guys running on a machine that didn’t have the latest desktop features, didn’t seem to me like the best idea.

Due to Leopard and its lack of support for Java 6, it seems many of these same engineers are changing their minds, like James Gosling.

(more…)

Getting into the RC airplane thing

rc_com2_damage.jpg

A couple of weeks ago, I finally bought my first RC airplane. I always wanted to fly one of these things when I was a kid, but never got to it. When a new hobby shop opened near work, I decided to take a peek to see if I should get an RC boat. I went with a friend from work who convinced me to get an airplane instead, so I got the HobbyZone Firebird Commander 2 model. This is a starter 2 channel plane, with this thing called “ACT” (Anti-Crash Technology) that makes it easier for you to fly.

Well, the ACT is not magical as you can see from the picture above. On my first day, I couldn’t find any good size fields to fly the thing in the first place. So I ended up messing up the wing on the first 2 tries, only flying the plane for a few seconds. Finally I ended up at a bigger location, and was successful flying the plane for a lot longer. Unfortunately I couldn’t land it, I didn’t really have enough space for a proper landing, and in one of the landing attempts the plane just nose dived and crashed. The wind didn’t help either, I should have followed the instructions and flown it with no wing.

The damages from this first day included:
(more…)

The “I can’t find the object I put in the map” code blooper of the day

dead_fish1.jpg

This one is fairly easy to catch, but it was a self inflicted code blooper that had me thinking for a bit.

public class Key implements java.io.Serializable
{
  String key;

  public Key(String key)
  {
    this.key = key;
  }

  @Override
  public String toString()
  {
    return key;
  }

  @Override
   public int hashCode()
   {
      super.hashCode();
   }

   @Override
   @SuppressWarnings("unchecked")
   public boolean equals(Object obj)
   {
       boolean retval = false;

       if (obj != null && getClass() == obj.getClass())
       {
         Key other = (Key)obj;
         retval = other.getKey().equals(getKey());
       }

      return retval;
   }
}

I used this class as a key into a Map. We would send this map over a serialized stream, and on the other side we couldn’t get the values by using the same keys (the keys are static finals/constants).

See if you can spot the error … it’s a bit obvious …

OK, you found it.

Yeah, it’s the hashCode(). You probably know about the equals()/hashCode() rule when using Maps.
Don’t know how that “super” got in there, but that was the problem. Simple of course. As a side note, I’ve been using Netbeans 6 and it has some interesting suggestions for genearting your equals and hashCode() methods. On the equals, I was a bit surprised to see it was using “getClass() == obj.getClass()“, I thought it would do “getClass().equals(obj.getClass())“, just because when I compare non primitive types I’m used to using the equals() method. Somehow this works, I guess because class definitions are loaded once? Intuitively I feel this is not the right way, but it works and seems to be accepted convention.

To be quite honest, I’ve been using “instanceof” for the longest time, and up until recently I didn’t know there was a debate about that one.

 

WP SlimStat