title: Android 4.3 ImageView ScaleType.MATRIX
body: <p>today I set up the new <a href="http://developer.android.com/about/versions/jelly-bean.html" rel="nofollow">Android JB 4.3</a> on my Nexus 7 and i tried to run my application.</p>
  
  <p>Everythings works like it should except one little thing about <a href="http://developer.android.com/reference/android/widget/ImageView.html" rel="nofollow">ImageViews</a> with <a href="http://developer.android.com/reference/android/widget/ImageView.ScaleType.html" rel="nofollow">ScaleType.MATRIX</a>.</p>
  
  <p>Basically what i have in my application is a <a href="http://developer.android.com/reference/android/widget/ImageView.html" rel="nofollow">ImageView</a> as background and accordingly to a <a href="http://developer.android.com/reference/android/support/v4/view/ViewPager.html" rel="nofollow">ViewPager</a> callbacks i move the focused part of the image updating the <a href="http://developer.android.com/reference/android/graphics/Matrix.html" rel="nofollow">Matrix</a> i gave to the imageView using <a href="http://developer.android.com/reference/android/widget/ImageView.html#setImageMatrix%28android.graphics.Matrix%29" rel="nofollow">setImageMatix( Matrix matrix )</a>.</p>
  
  <p>the problem seems to be that i can't update the matrix anymore, i just have to instantiate a new one a pass it to the <a href="http://developer.android.com/reference/android/widget/ImageView.html" rel="nofollow">ImageView</a>.</p>
  
  <p>i managed to work around it instantiating everytime a new <a href="http://developer.android.com/reference/android/graphics/Matrix.html" rel="nofollow">Matrix</a> but it seems awfully memory expensive compared to the old version.</p>
  
  <p>is this a BUG?
  is there a way to udpate the <a href="http://developer.android.com/reference/android/graphics/Matrix.html" rel="nofollow">Matrix</a>? ( i by the way already tried to <a href="http://developer.android.com/reference/android/view/View.html#invalidate%28%29" rel="nofollow">invalidate()</a> the ImageView ecc. )</p>
  
  <p><strong>NOT WORKING</strong></p>
  
  <pre><code>    private void updateMatrix( final int page, final double offset ) {          
          double pagePosition = page + offset;
  
          Matrix matrix = imageView.getImageMatrix();
          matrix.setScale( scale, scale );
          matrix.postTranslate( - (float) ( pagePosition * pageWidth ) , 0 );
  
          imageView.setImageMatrix( matrix );
  
          imageView.invalidate();
      }
  </code></pre>
  
  <p><strong>WORKING</strong></p>
  
  <pre><code>    private void updateMatrix( final int page, final double offset ) {          
          double pagePosition = page + offset;
  
          Matrix matrix = new Matrix();
          matrix.setScale( scale, scale );
          matrix.postTranslate( - (float) ( pagePosition * pageWidth ) , 0 );
  
          imageView.setImageMatrix( matrix );
  
          imageView.invalidate();
      }
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>in the first case the image is shown at the top left corner of the ImageView without any scale or translate applied to it, like if the matrix is back to identity.</p>