“ArrayAdapter requires the resource ID to be a TextView” XML problems

The ArrayAdapter requires the resource ID to be a TextView XML exception means you don’t supply what the ArrayAdapter expects. When you use this constructor: R.Layout.a_layout_file must be the id of a xml layout file containing only a TextView(the TextView can’t be wrapped by another layout, like a LinearLayout, RelativeLayout etc!), something like this: If you want your list row layout to be something a little different … Read more

Android ListView headers

Here’s how I do it, the keys are getItemViewType and getViewTypeCount in the Adapter class. getViewTypeCount returns how many types of items we have in the list, in this case we have a header item and an event item, so two. getItemViewType should return what type of View we have at the input position. Android will then take care of passing you the right type of View in convertView automatically. Here what … Read more