Friday, December 19, 2008

Setting Indeterminate Progress Bar in ListActivity

In Android it's fairly easy to set the indeterminate progress indicator of the current window spinning from an Activity while a thread is working or something. This code outlines it how to do it.

I figured it was that easy when I went to do it for a ListActivity, but it turns out there's a twist. For that feature request to work, you need to call setContentView, but ListActivities come with a default view already set, so setContentView never gets called. That means the indicator never gets requested and doesn't show up.

To get around that problem one way, just set a custom list view, as described here, and in onCreate call setContentView.

Just a quick PSA incase you thought I forgot about this blog.

1 comment:

amiuhle said...

Great hint, thanks a lot :)