THIS CONTENT DOWNLOAD SHORTLY

Objective

Main objective of this Pinch Zoom tutorial is to help you to zoom Image.

 

You will get Final Output:

  • Pinch Zoom
  • Pinch Zoom
  • Pinch Zoom
 

Step 1 Import needed .jar files

First we need following Jar files imagezoom.jar

Download from the given link: imagezoom.jar

 

Step 2 Import Java Files

Add jar files to your Android Project from the given Path ProjectName >> libs

 

Step 3 ImageView_Main.java file

Now Start Coding for the Pinch-Zoom Image. Create new class file named ImageView_Main.java and put following code into class.

public class ImageView_Main extends Activity {
private ImageViewTouch ivLargeImage;
private Bitmap myBitmap;
 
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.image_view);
ivLargeImage = (ImageViewTouch) findViewById(R.id.ivLargeImageView);
 
// if image size is too large.Then scale image.
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
 
                // provide image path for create Bitmap from image.
                // myBitmap = BitmapFactory.decodeFile( //provide here image file path//);
//Or
myBitmap = BitmapFactory.decodeResource(//provider here resource //);
 
if (options.outWidth > 3000 || options.outHeight > 2000) {
options.inSampleSize = 4;
} else if (options.outWidth > 2000 || options.outHeight > 1500) {
options.inSampleSize = 3;
} else if (options.outWidth > 1000 || options.outHeight > 1000) {
options.inSampleSize = 2;
}
options.inJustDecodeBounds = false;
 
myBitmap = BitmapFactory.decodeResource//provider here resource //);
ivLargeImage.setImageBitmapReset(myBitmap, 0, true);
   }
}
 

Step 4 image_view.xml file

Create image_view.xml file. ImageView Declare as bellow in the image_view.xml file

<com.theappguruz.imagezoom.ImageViewTouch
            android:id="@+id/ivLargeImageView"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_gravity="center" />

I hope you enjoy this tutorial and it would be helpful to you.

Got an Idea of Android App Development? What are you still waiting for? Contact us now and see the Idea live soon. Our company has been named as one of the best Android App Development Company in India.

An entrepreneur who has founded 2 flourishing software firms in 7 years, Tejas is keen to understand everything about gaming - from the business dynamics to awesome designs to gamer psychology. As the founder-CEO of a company that has released some very successful games, he knows a thing or two about gaming. He shares his knowledge through blogs and talks that he gets invited to.

face mask Belial The Demon Headgear Pocket Staff Magic