caltangelo caltangelo - 1 month ago 10
Android Question

android default xml layout not loading

I'm trying to make a ListActivity with check boxes using one of the built in android layouts,

android.R.layout.simple_list_item_multiple_choice
. For background, I'm fetching the list in a private
AsyncTask
, then calling the adapter like this:

listActivity.setListAdapter(new ArrayAdapter<String>(listActivity,
android.R.layout.simple_list_item_multiple_choice, mDisplayList));


However when I run my code, the
ListView
is displayed with
list_item.xml
, which I'm using for all the other ListViews in my project. Any idea why this is happening?

Answer

The reason the right xml layout wasn't being used was because my AsyncTask was extending my (other) custom AsyncTask that used another xml layout and I left in this line.

super.onPostExecute();

which was at the end of the method so the inherited layout trumped the one I wanted.

Comments