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

I am getting an error when trying to set my view to display the ListView for the file I want to display(text file). I am pretty sure it has something to do with the XML. I just want to display the information from this.file = fileop.ReadFileAsList(“Installed_packages.txt”);. My code: public class Main extends Activity { private … Read more

What is “android.R.layout.simple_list_item_1”?

I’ve started learning Android development and am following a todolist example from a book: // Create the array list of to do items final ArrayList<String> todoItems = new ArrayList<String>(); // Create the array adapter to bind the array to the listView final ArrayAdapter<String> aa; aa = new ArrayAdapter<String>( this, android.R.layout.simple_list_item_1, todoItems ); myListView.setAdapter(aa); I can’t … 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