Tag: Android

AsyncTaskLoader: Populate a Static List View

One of the first things I tried to do while developing an Android app is asynchronously populate a statically defined list view. This turned out to be a much more challenging task than I anticipated, and apparently nobody else on the entire world wide web is attempting to do this (or I just didn’t google right 0_o).

Specifically, I wanted to define a ListView (or Spinner or whatever) in a layout XML file, and populate it via data from a restful web service. Initially I tried to do this in the onCreate(), but got theĀ android.os.NetworkOnMainThreadException. So, obviously I needed to pull the data from a restful web service asynchronously. This post is going to explain how I did that.
Continue reading