title: how to correct this error: java.lang.OutOfMemoryError
body: <p>This is my code:</p>
  
  <pre><code>public void onPictureTaken(byte[] data, Camera camera) {
      Bitmap foto = BitmapFactory.decodeByteArray(data, 0, data.length);
      wid = foto.getWidth();
      hgt = foto.getHeight();
  
      Bitmap newImage = Bitmap.createBitmap(wid, hgt, Bitmap.Config.ARGB_4444);
      Canvas canvas = new Canvas(newImage);
      canvas.drawBitmap(foto, 0f, 0f, null);
      if (newImage.getWidth() &gt; newImage.getHeight()) {
          Matrix matrix = new Matrix();
          matrix.postRotate(90);
          newImage.createBitmap(newImage, 0, 0, wid, hgt, matrix, true);
  
      }
  }
  </code></pre>
  
  <p>This is my error:</p>
  
  <pre><code>FATAL EXCEPTION: main
  java.lang.OutOfMemoryError
  at android.graphics.Bitmap.nativeCreate(Native Method)
  at android.graphics.Bitmap.createBitmap(Bitmap.java:689)
  at android.graphics.Bitmap.createBitmap(Bitmap.java:666)
  at android.graphics.Bitmap.createBitmap(Bitmap.java:633)
  at com.supratecnologia.activity.Camera_Activity.onPictureTaken(Camera_Activity.java:189)
  at android.hardware.Camera$EventHandler.handleMessage(Camera.java:768)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:137)
  at android.app.ActivityThread.main(ActivityThread.java:5041)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:511)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
  at dalvik.system.NativeStart.main(Native Method)
  </code></pre>