title: Out of memory and OpenGL errors while manipulating two images on android
body: <p>Hi: I have to images on two files (left and right) What I want to do is show them side by side in a ImageSwitcher. This is the function that returns the Drawable that I want to set in the imageswitcher:</p>
  
  <pre><code>public Drawable getImage(String left, String right){
      System.err.println("Decoding both images");
      Bitmap Left = BitmapFactory.decodeFile(left);
      Bitmap Right = BitmapFactory.decodeFile(right);
      int height = Math.max(Left.getHeight(),Right.getHeight());
      int width = Left.getWidth() + Right.getWidth();
      Bitmap result = Bitmap.createBitmap(width,height,Config.RGB_565);       
      System.err.println("Creating the canvas");
      Canvas bothImages = new Canvas(result);
      System.err.println("Drawing both images beside each other");
      bothImages.drawBitmap(Left, 0f, 0f, null);
      bothImages.drawBitmap(Right, Left.getWidth(), 0f, null);
      System.err.println(Integer.toString(bothImages.getWidth()) + " x " + Integer.toString(bothImages.getHeight())); 
      bothImages.rotate(90f);
      System.err.println(Integer.toString(bothImages.getWidth()) + " x " + Integer.toString(bothImages.getHeight()));
      System.err.println("returning Drawable Left");
      return new BitmapDrawable(result);
  }
  </code></pre>
  
  <p>I have two problems. If I use Config.ARGB_8888 I get out of memory errors. So I changed to RGB_565. However this will reduce the qualities of the images. Is there anyway around this?</p>
  
  <p>Second even I change the config settings I get the following console messages:</p>
  
  <pre><code>06-19 09:16:23.760: WARN/System.err(26218): Attempting to show /mnt/sdcard/Work/.temp/0000.jpg
  06-19 09:16:23.760: WARN/System.err(26218): Decoding both images
  06-19 09:16:24.510: WARN/System.err(26218): Creating the canvas
  06-19 09:16:24.510: WARN/System.err(26218): Drawing both images beside each other
  06-19 09:16:24.530: WARN/System.err(26218): 2560 x 1971
  06-19 09:16:24.530: WARN/System.err(26218): 2560 x 1971
  06-19 09:16:24.530: WARN/System.err(26218): returning Drawable Left
  06-19 09:16:24.570: WARN/OpenGLRenderer(26218): Bitmap too large to be uploaded into a texture
  06-19 09:16:24.850: WARN/OpenGLRenderer(26218): Bitmap too large to be uploaded into a texture
  06-19 09:16:24.870: WARN/System.err(26218): Inside On resume
  06-19 09:16:24.870: WARN/System.err(26218): About to set up animations
  06-19 09:16:24.870: WARN/System.err(26218): On resume Done
  06-19 09:16:24.870: WARN/System.err(26218): Attempting to show /mnt/sdcard/Work/.temp/0000.jpg
  06-19 09:16:24.870: WARN/System.err(26218): Decoding both images
  06-19 09:16:25.610: WARN/System.err(26218): Creating the canvas
  06-19 09:16:25.610: WARN/System.err(26218): Drawing both images beside each other
  06-19 09:16:25.640: WARN/System.err(26218): 2560 x 1971
  06-19 09:16:25.640: WARN/System.err(26218): 2560 x 1971
  06-19 09:16:25.640: WARN/System.err(26218): returning Drawable Left
  06-19 09:16:25.660: WARN/OpenGLRenderer(26218): Bitmap too large to be uploaded into a texture
  06-19 09:16:25.690: WARN/OpenGLRenderer(26218): Bitmap too large to be uploaded into a texture
  </code></pre>
  
  <p>And I obviously never see the generated Image. So I want to know what I'm doing wrong?</p>
  
  <p>On a side note the first two images should be shown when an activity is started so the code above is called on the OnResume Method of the activity. Can any one tell me why this method is executed twice (as it is obvious by the printout)? Because maybe my out of memory errors 
  have to do with this...</p>
  
  <p>Thanks for any help in advance.</p>