how do i set a custom color for a row/col in gridview in android?
My gridView consists of a gridArray of type Items which I pass all the data I want it to display, its for a timetable. I calculate the position of the items based on where I want them and then Display the items. I am not able to change the background color of the cell. How would I go about doing that.
for (int d1 = 0; d1 < days.size(); d1++) { if (myModules.get(1).equals(days.get(d1))) { for (int e1 = 0; e1 < times.size(); e1++) { if (startEndM1[0].equals(times.get(e1))) { gridArray.set(((e1 * 5) + d1),new Item(myModules.get(0))); if (!startEndM1[1].equals(times.get(e1 + 1))) { gridArray.set((((e1 * 5) + d1) + 5), new Item(myModules.get(0))); } int position = ((e1 * 5) + d1); ((View) gridView.getItemAtPosition(position)).setBackgroundColor(Color.BLUE); } } } } the above code is justto set an item onto its specified position, If I have to change the color of that particular backgorund cell where I am setting the item, it crashes. The Grid view should recognize the position of the item where its at. Some help would be really apprectiated, thanks.