title: Android how to do image screen slide?
body: <p>I'm building a very basic gallery on android, it shows the last image on the camera folder and the user can slide left to see the previous one.</p>
  
  <p>I finished an implementation using a viewpager, and a pagerAdapter using sampleSize to scale images. My problem is that the implementation is nowhere as efficient as the default gallery app, every time you slide an image you have to wait around 200ms for the next one to load. So basically my idea on how to implement it is not working out.</p>
  
  <p>How can I do this efficiently, and if possible with an implementation that allows zooming in and out later on?</p>
  
  <hr>
  
  <p>This looks promising but I don't know how to implement it with files instead of drawables
  <a href="http://www.androidviews.net/2012/11/photoview/">http://www.androidviews.net/2012/11/photoview/</a></p>
  
  <hr>
  
  <p>EDIT:</p>
  
  <p>I've managed to improve speed a bit using photoview (a hacked viewpager), however it takes too much to convert the filepaths to bitmaps or drawables.</p>
  
  <p>I have tried these two methods suggested by dilix and iDroid Explorer:</p>
  
  <pre><code>// Method A
  Drawable d = Drawable.createFromPath(imagePath);
  imageView.setImageDrawable(d);
  
  // Method B
  Bitmap myBitmap = BitmapFactory.decodeFile(imagePath);
  imageView.setImageBitmap(myBitmap);
  </code></pre>
  
  <p>But both produce error <code>Bitmap too large to be uploaded into a texture</code>. I need to get the image to the imageView as fast as possible and somehow bypass this error and maybe I'll get a decent speed. Right now I'm scaling the images and converting them to a drawable but it's not very efficient. </p>