

In the calendar, When I select a date, I need to change the background color of the grid element, as well as remove the background of the previous selected element. When I press and hold the date 10, (shown in Figure 2), an orange color is displayed. But when I focused the mouse, Color did not show it.
gridcell.setOnClickListener (new OnClickListener () {
@Override
public void onClick(View v) {
String date_month_year = (String) v.getTag();
selected_date = date_month_year;
String[] day_color = date_month_year.split("-");
String theday = day_color[0];
selectedDateEvents(theday);
listadapter.notifyDataSetChanged();
prev_pos = cur_pos;
cur_pos = position;
Log.d("curr and prev", position+" n "+prev_pos);
parent.getChildAt(cur_pos).setBackgroundResource(R.drawable.calendar_tile_small);
parent.getChildAt(prev_pos).setBackgroundResource(R.drawable.calendar_tile_small_black);
GridCellAdapter.this.notifyDataSetChanged();
}
});
Can someone please help me?
source
share