jr3 (63K)

Android Sheep

Posted by Jessica Sat, 22 Mar 2008 22:12:00 GMT

The Goal

Using the Android development kit, create an Android application that allows users to scroll through images of electric sheep and vote on which images they like.

First impression of Android: rich, open API with quick-n-easy dev set up

Holy shit! The documentation is like drinking from a water hose, definitely worse than a JavaDoc. The pay off is that there is a ton of features that “come with” this open source SDK. As mentioned on android linux,

usually you have major companies forming an oligarchy of mobile handset programming, but not so much with Android, anyone, even the girl next door, could be the person making the next great Android based mobile application.

And if you are familiar with Eclipse and HttpClient and jaxp and a slew of other things int the java world, then developing an Android app should be a snap. :-)

First lesson learned: keep your performance tuning cap on

Go ahead and resize all images to fit the phone screen. One issue that Gloria and I encountered was that switching between images in the image switcher was slow. I am not sure what the best way to do this is if you do not know the screen size; i mean i guess you would simply detect the screen size and choose the corresponding image size, but this assumes that the appropriately sized image would be available to you.

I did change the scaletype to CENTER, but I didn’t really notice a big performance difference… I mean I couldn’t even tell which one was faster. Per the moderator’s comments… the thumbnail isn’t stretched. The thumbnail and the png are two different files. But the ‘stretching’ that could be giving us problems is the shrinking of the png to fit it inside the small screen—I can see this because when the scaletype is set to CENTER or not set at all, the image appears much larger and not all of it fits on the screen. But so, unless we resize the images, there will always be some stretching/shrinking… it seems reasonable to close the ticket; we can optimize by resizing if there continues to be a performance issue. Anyways… interesting stuff. I am beginning to see what some of the challenges would be in writing a mobile app.

Second lesson learned: be mindful of your focus

Either do not set the focus on the ImageView or pass in the gallery so you can set the focus back to the gallery. I received some great help from the Android Beginners Google Group.

Setup Tips
  1. Another issue that tripped me up was logging. Sysouts won’t work… or at least Android provides its own logging. This logging how to helped me out. The short of it is use “adb logcat” command to view logging done by android.util.Log.
  2. Don’t waste time decompiling; get the source. Although it never fails, I end up decompiling stuff anyways. <^_^>

Updates to Come: I wrote this post some time ago, and there are several cool things that I have learned since that time… more updates to come. Currently, I am working on displaying images downloaded from the sheep server given some set of sheep.


designed by jowensbysandifer