Android Open Source - AndroidImageViewZoom Image View Zoom Example1 Activity






From Project

Back to project page AndroidImageViewZoom.

License

The source code is released under:

Copyright (c) 2011 Igor Crevar http://extrafull.com/igorcrevar/ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "...

If you think the Android project AndroidImageViewZoom listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.rogicrew.imagezoom.example;
/*from   ww  w.  j a v a 2 s .  c  om*/
import com.rogicrew.imagezoom.ImageViewZoom;

import android.app.Activity;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;

public class ImageViewZoomExample1Activity extends Activity {
  private ImageViewZoom mImageView;
  private Bitmap mBitmap;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        mImageView = (ImageViewZoom)findViewById(R.id.imagezoomComponent);
        loadBitmap(R.drawable.picture1);
    }
    
    private void loadBitmap(int res){
      if (mBitmap != null){
        mBitmap.recycle();
      }
      mBitmap = UnscaledBitmapOperations.loadFromResource(getResources(), res, null);
      mImageView.setImage(mBitmap);
    }
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.menu, menu);
        return true;
    }
    
    @Override
    public boolean onOptionsItemSelected(MenuItem item) 
    {
        switch (item.getItemId()) {
        case R.id.picture1:
          loadBitmap(R.drawable.picture1);
          return true;
        case R.id.picture2:
          loadBitmap(R.drawable.picture2);
          return true;  
        case R.id.picture3:
          loadBitmap(R.drawable.picture3);
          return true;  
        case R.id.picture4:
          loadBitmap(R.drawable.picture4);
          return true;   
        }
        return false;
    }
}




Java Source Code List

com.rogicrew.imagezoom.ImageViewZoomOptions.java
com.rogicrew.imagezoom.ImageViewZoom.java
com.rogicrew.imagezoom.example.ImageViewZoomExample1Activity.java
com.rogicrew.imagezoom.example.ImageViewZoomTest.java
com.rogicrew.imagezoom.example.UnscaledBitmapOperations.java
com.rogicrew.imagezoom.ontouch.OnTouchInterface.java
com.rogicrew.imagezoom.ontouch.OnTouchMulti.java
com.rogicrew.imagezoom.ontouch.OnTouchSingle.java
com.rogicrew.imagezoom.ontouch.Pointer.java