title: Android - States for different imageview resources as a listview items
body: <p>I've customized a listview item.
  Each item list has an imageview. </p>
  
  <p>The type of the imageview is defined by a category variable, that I save in a DB.</p>
  
  <p>So lets's say there are three items in the listview with those three categories  - blue, red and black.</p>
  
  <p>So the bindView of the CursorAdapter is as following -</p>
  
  <pre><code>    public void bindView(View view, Context context, Cursor cursor) {
  
  String cat = cursor.getString(cursor.getColumnIndex(Constans.CATEGORY));
  
  ImageView iv = (ImageView) view.findViewById(R.id.imageView);
  
      if (cat.equalsIgnoreCase("black")) {
                  iv.setImageResource(R.drawable.black_un);
              }
  
              if (cat.equalsIgnoreCase("blue")) {
                  iv.setImageResource(R.drawable.blue_un);
              }
  
              if (cat.equalsIgnoreCase("red")) {
                  iv.setImageResource(R.drawable.red_un);
              }
  
  }
  </code></pre>
  
  <p>Now what I would like to do is when the listviewitem is being pressed - I want that the imageview will show the relevant "pressed" image -</p>
  
  <p>what I mean is that now the imageview is showing the non pressed state image - 
  but when the user pressing on the listview item I want that it will show the "pressed" image - and than the imageview will present the non pressed image again - just as you can do with a button.</p>
  
  <p>Any ideas how can I do that? Mind that there's a different image at each listview raw - depends of course on the category.</p>