title: Unselect an Android View when selecting another one
body: <p>I have 4 ImageView's inside a LinearLayout. There is also a selector.xml file that sets background color red when android:state_selected="true"</p>
  
  <p>What I want is to have <strong>only</strong> one view selected. I don't know how I can keep a reference to the last selected view so I can unselected it. </p>
  
  <p>The code I have so far is : </p>
  
  <pre><code>        ImageView beer = (ImageView)findViewById(R.id.beer_button);
      ImageView coffee = (ImageView)findViewById(R.id.coffee_button);
      ImageView food = (ImageView)findViewById(R.id.food_button);
      ImageView wifi = (ImageView)findViewById(R.id.wifi_button);
  
      beer.setOnClickListener(new OnClickListener()   {
             public void onClick(View v)     {
                 Log.v("flag", "1");
                 v.setSelected(true);
             }
      });
  
  
  
      coffee.setOnClickListener(new OnClickListener() {
             public void onClick(View v)     {
                 Log.v("flag", "2");
                 v.setSelected(true);
             }
      });
  
      food.setOnClickListener(new OnClickListener()   {
             public void onClick(View v)     {
                 Log.v("flag", "3");
                 v.setSelected(true);
             }
      });
  
      wifi.setOnClickListener(new OnClickListener()   {
             public void onClick(View v)     {
                 Log.v("flag", "4");
                 v.setSelected(true);
             }
      });
  </code></pre>