title: set cardview Background logic in Android
body: <p>i want to when one <code>cardview</code> click event call it's background color change . but i want to only one <code>cardview</code> color change at a time means i click on <strong>1st</strong> <code>cardview</code> , color change yellow , but when i click on <strong>2nd</strong> <code>cardview</code> change color yellow ,and other all card set color white.</p>
  
  <p>Here is my code :-</p>
  
  <pre><code>btnOpt1.setOnClickListener {
          btnOpt1.setCardBackgroundColor(Color.parseColor("#fcfca9"))
      }
  
      btnOpt2.setOnClickListener {
          btnOpt2.setCardBackgroundColor(Color.parseColor("#fcfca9"))
      }
  
      btnOpt3.setOnClickListener {
          btnOpt3.setCardBackgroundColor(Color.parseColor("#fcfca9"))
      }
  
      btnOpt4.setOnClickListener {
          btnOpt4.setCardBackgroundColor(Color.parseColor("#fcfca9"))
      }
  
      btnOpt5.setOnClickListener {
          btnOpt5.setCardBackgroundColor(Color.parseColor("##fcfca9"))
      }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/WUJFB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WUJFB.png" alt="enter image description here"></a></p>