title: (Android) Making Images Visible/Not Visible when touched
body: <p>This is my updated code.  It doesn't detect movement at all now.  Maybe I shouldn't be making each Image an instance?  Basically I want to user to be able to swipe through all the images to make them dissapear.        </p>
  
  <p>Thanks for all the help.</p>
  
  <pre><code>package com.picomputing.mythirdapplication;
  
  import android.content.Context;
  import android.graphics.Color;
  import android.graphics.Rect;
  import android.util.AttributeSet;
  import android.view.MotionEvent;
  import android.view.View;
  import android.widget.ImageView;
  
  /**
   * Created by Paul on 8/13/13.
   */
  public class Pin extends ImageView implements View.OnTouchListener {
  
      boolean isPinDown;
  
      public Pin(Context context) {
          super(context);
          this.isPinDown = false;
      }
  
      public Pin(Context context, AttributeSet attrs) {
          super(context, attrs);
          this.isPinDown = false;
      }
  
      public Pin(Context context, AttributeSet attrs, int defStyle) {
          super(context, attrs, defStyle);
          this.isPinDown = false;
      }
  
      public boolean pinDown() {
          return this.isPinDown;
      }
  
      public void setPinDown() {
          this.isPinDown = true;
      }
  
      public void setPinUp() {
          this.isPinDown = false;
      }
  
      public void togglePin() {
          if (isPinDown == false)
          {
              isPinDown = true;
              this.setImageResource(Color.TRANSPARENT);
          }
          else
          {
              isPinDown = false;
              this.setImageResource(R.drawable.pin);
          }
      }
  
      @Override
      public boolean onTouch(View view, MotionEvent event) {
          switch (event.getAction()){
              case MotionEvent.ACTION_MOVE:
                  int x = (int) event.getX();  //--relative to mLayout--
                  int y = (int) event.getY();  //--relative to mLayout--
                  Rect r = new Rect();
                  view.getHitRect(r);
                      if(r.contains(x,y) &amp;&amp; view instanceof ImageView){
                          togglePin();
                      }
          }
          return true;
      }
  }
  </code></pre>