Archive for August, 2010

Today’s Meetup: GTUG

Excellent meetup today over at Startpad in downtown Seattle. We got to listen to a few folks show off some GWT projects. Overall it was interesting. I can’t say that the direction we’re headed with mobile and web development will see us using any GWT soon, but as things start rolling, this is something we’ll definitely start looking at as we foray into complex, interactive AJAX-y web UI/UX.

The best part was networking with other developers. The lead of Goto, a home screen replacement for Android, shared with us some challenges he and his team have overcome and how his team operates. I look forward to see what else he and his partners at Innoweb Tech release next.

These meetups are a great place to network. It takes a little effort to step out of our shell but well worth it. Sometimes I do sit there and wonder if some of those that make it are just there for the free pizza. Either way, see you there next month!

ListActivity and Missing Android.R.id.list

It’s three in the morning, you are banging at setting up a sweet list. Things are pretty and there is a nice flow with a loading screen within your Activity. You have your post loading layout with the proper code:

<ListView android:id="@id/android:list"
               android:layout_width="fill_parent"
               android:layout_height="fill_parent"
               android:layout_weight="1"
               android:drawSelectorOnTop="false"/>

You run your application and get hit with an exception which reads something like this:

java.lang.RuntimeException: Your content must have a ListView whose id
attribute is 'android.R.id.list' 

“What the heck?!”, you think, “@id/android:list is right there!” You browse Google and wade through examples. The documentation makes vague references to something regarding android:empty which is not what you are looking for (well it code be something else you are looking for).

The conclusion is to add a little ListView with that id to make sure it satisfies the requirement that the ListActivity has a ListView of that id in it before you load your final ListView which you will be populating with data:

<ListView android:id="@id/android:list"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:drawSelectorOnTop="false"
            android:visibility="gone" />

And now you should have conquered that dreaded exception. What it comes down to is that an Activity extending from ListActivity must have that special id defined within the layout setContentView() or don’t set the view until you are ready. However, most users probably want to see something rather than staring at a black screen waiting for your ListView Activity to load. :)