I am new to android. I got stuck while doing an application.I have taken 5 textviews with time slots,I would like to show that when I click one text view it should change its background color and when I click another textview the first text view's background color has to disappear and present text view's color has to be highlight.
Here I am posting my code:
public void onClick(View v) {
switch (v.getId()){
case R.id.time_slot_one:
setTimeSlotOne.setBackgroundColor(Color.parseColor("#bdbdbd"));
break;
case R.id.time_slot_two:
setTimeSlotTwo.setBackgroundColor(Color.parseColor("#bdbdbd"));
break;
case R.id.time_slot_three:
setTimeSlotThree.setBackgroundColor(Color.parseColor("#bdbdbd"));
break;
case R.id.time_slot_four:
setTimeSlotFour.setBackgroundColor(Color.parseColor("#bdbdbd"));
break;
case R.id.time_slot_five:
setTimeSlotFive.setBackgroundColor(Color.parseColor("#bdbdbd"));
break;
}