This is how I am doing the listing I would like to know if it is possible to put each item with a different color for example 1 to white and another to black
ArrayAdapter adapter = new ArrayAdapter<>(MainActivity.this, android.R.layout.simple_list_item_1, list);
lista.setAdapter(adapter);
I saw this example but it only fits if I have a class adapter, any way I can adapt this to the code I showed above?
public View getView(int position, View convertView, ViewGroup parent) {
/* remainder is unchanged */
convertView.setBackgroundColor(position % 2 == 0 ? Color.WHITE : Color.GREY);
return convertView;
}