I am new to android and working with listviews. I am using SimpleCursorAdapter to populate the list.
SimpleCursorAdapter adapter = new SimpleCursorAdapter (this, R.layout.mytaskslayout, cursor, new String[] {"Aircraft","Discrepancy", "ARR_FLT", "ARR_Gate", "DPT_FLT", "DPT_Gate"}, new int[] {R.id.ac, R.id.discrepancy, R.id.arrac, R.id.arrgate, R.id.dptac, R.id.dptgate});
list.setAdapter(adapter);
There are two types in the info that I am displaying, new task and old tasks. I would like to have different background color for those types. How can I do that? Please help.
You need to extend
SimpleCursorAdapterand override thenewView()method to accomplish what you want.See other questions on this topic:
How to change backgrounds for specific rows using SimpleCursorAdapter