title: adding zoom in zoom out function
body: <p>i have written this code for loading multiple of images from url one by and swiping effect on images.....but now i need to zoom in &amp; out the images on finger spread...i think pinch zoom...i am unable to implement the zooming function..also confused about where to place the function or i should make a class for this..please help....thanks and regards..</p>
  
  <p>this is my code:</p>
  
  <pre><code>package com.conn;
  
  import android.R;
  import android.app.Activity;
  import android.graphics.Bitmap;
  import android.graphics.BitmapFactory;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.GestureDetector;
  import android.view.GestureDetector.SimpleOnGestureListener;
  import android.view.MotionEvent;
  import android.view.View;
  import android.view.animation.Animation;
  import android.view.animation.AnimationUtils;
  import android.widget.ImageView;
  import android.widget.ViewFlipper;
  
  public class swipe_touch extends Activity {
      private static final String LOGID = "CHECKTHISOUT";
  
      private static final int SWIPE_MIN_DISTANCE = 120;
      private static final int SWIPE_MAX_OFF_PATH = 250;
      private static final int SWIPE_THRESHOLD_VELOCITY = 200;
      private GestureDetector gestureDetector;
      View.OnTouchListener gestureListener;
  
      private Animation slideLeftIn;
      private Animation slideLeftOut;
      private Animation slideRightIn;
      private Animation slideRightOut;
      private ViewFlipper viewFlipper;
      int i;
      ImageView[] img = new ImageView[24];
  
      String message = "Initial Message"; 
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  //        setContentView(R.layout.main);
        //Set up viewflipper
          try
          {
          viewFlipper = new ViewFlipper(this);   
          for(i=1;i&lt;=3;i++)
          {
          Log.i("for","loop");
          j_comm_func funs = new j_comm_func();
          BitmapFactory.Options bmOptions;
          bmOptions = new BitmapFactory.Options();
          bmOptions.inSampleSize = 1;
          Bitmap bm = funs.LoadImage("http://65.175.77.34/newsnow/2462011/largest3/2462011-md-hr-"+i+".jpg", bmOptions);
          img[i] = new ImageView(this);
          img[i].setImageBitmap(bm);
          viewFlipper.addView(img[i]);
  
          }
          }
          catch(Exception e)
          {
              Log.i("error",e.getMessage());
          }
  
  
          //set up animations
          slideLeftIn = AnimationUtils.loadAnimation(this, R.anim.slide_out_right);
          slideLeftOut = AnimationUtils.loadAnimation(this, R.anim.slide_in_left);
          slideRightIn = AnimationUtils.loadAnimation(this, R.anim.slide_in_left);
          slideRightOut = AnimationUtils.loadAnimation(this, R.anim.slide_out_right);
  
  
          //put up a brownie as a starter
          setContentView(viewFlipper);
  
          gestureDetector = new GestureDetector(new MyGestureDetector());
      }
  
      public class MyGestureDetector extends SimpleOnGestureListener {
          @Override
          public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
              try {
                  if (Math.abs(e1.getY() - e2.getY()) &gt; SWIPE_MAX_OFF_PATH)
                      return false;
                  // right to left swipe
                  if(e1.getX() - e2.getX() &gt; SWIPE_MIN_DISTANCE &amp;&amp; Math.abs(velocityX) &gt; SWIPE_THRESHOLD_VELOCITY) {
                      Log.v(LOGID,"right to left swipe detected");
                      viewFlipper.setInAnimation(slideLeftIn);
                      viewFlipper.setOutAnimation(slideLeftOut);
                      viewFlipper.showNext();
                      setContentView(viewFlipper);
  
                  } // left to right swipe 
                  else if (e2.getX() - e1.getX() &gt; SWIPE_MIN_DISTANCE &amp;&amp; Math.abs(velocityX) &gt; SWIPE_THRESHOLD_VELOCITY) {
                      Log.v(LOGID,"left to right swipe detected");                    
                      viewFlipper.setInAnimation(slideRightIn);
                      viewFlipper.setOutAnimation(slideRightOut);
                      viewFlipper.showPrevious();
                      setContentView(viewFlipper);
  
                  }
              } catch (Exception e) {
                  // nothing
              }
              return false;
          }
      }
  
  
  
      // This doesn't work
      @Override
      public boolean onTouchEvent(MotionEvent event) {
          if (gestureDetector.onTouchEvent(event)){
              Log.v(LOGID,"screen touched");
              return true;
          }
          else{
              return false;
          }
      }
  }
  </code></pre>