title: display huge Images in Android
body: <p>I'm intending to display very large Images in Android. <br><br><strong>My first solution</strong> - to supply them as pdf - fails because not every handheld got a pdf-viewer preinstalled, and I don't want to require the users to install one.  </p>
  
  <p>So I have a png now <strong>(width = 3998px height=2827px)</strong> that I want to display. I downloaded this image to test how it would be displayed the gallery. It was quite painful. It seems that the galery renders this picture only once, and if I Zoom in, I cannot read the text at all.<br><br>
  So I wrote a testActivity which simply has an ImageView nested in a LinearLayout. I put the image into the drawable and set it as ImageView's image-source.
  Unforunately the app crashes immediatly, due to an "</p>
  
  <pre><code> ERROR/AndroidRuntime(8906): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget"  
  </code></pre>
  
  <p>I didn't expect that ONE single Image can be too large for<code>VM's memory</code>. I played a little bit around, set <code>ImageViews</code> size to <code>3998 &amp; 2827px</code> , put the Image to <code>sdCard</code> and read it manually with a <code>fileInputStream</code>.<br>
  To my big surprise it now shows my image, but if I turn my <strong>Nexus S horizontal</strong> I get the same <code>OutOfMemoryError</code> as before.<br><br>
  Can somewone point me the main difference between recieving a Bitmap through a <code>FileInputStream</code> or to set it as <code>ImageView's</code> source.   <br><br>
  Also I'm not able to scroll comfortable with two parent <code>scrollViews</code><br><br>
  I searching for a simple solution to display <code>ONE large image</code> at a time with the ability to <code>scroll horizontal and vertical</code> while able to zoom in and out.</p>
  
  <p>here is a sample of the image I want to display
  <img src="https://i.stack.imgur.com/ynnIh.png" alt="enter image description here"></p>